From patchwork Wed Feb 9 09:19:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 12739898 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7C2EFC433F5 for ; Wed, 9 Feb 2022 09:19:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 362DC10E660; Wed, 9 Feb 2022 09:19:39 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04FD710E35A; Wed, 9 Feb 2022 09:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644398377; x=1675934377; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=lw+t0ymKc5gweSXGRCzsCZroyd/waMXDaOSv5aYUXXQ=; b=EQUUCXY7ImvmgTMbXg5wr2LESwn+XmCJYrs4Dl0+hUNJYe6y6+Tevlt3 /ugGJ5QNS7aQr5Wn4CDyV2UHXWzF9LUbptOH6kArmuIMIkiwjRrJbW44U Nx4OoIL/p/57b/mQ1phpT5IOf1kMVQfBTiQdVl9PkHFeQBDGSzpMSta4r q/42yFLaGf0rVAl5bGTiKDjmX89omFJlrULzbyal8c7050Ttnqyjncpjh 7i8hZ0H4d9RYdoEwQqp80kixT7RjByRmbATzOOaEDCjsWdI+UFs/jqWlh yJ0Q4lA+Nfq7OojeoEWtbc2SYg8IOwp+UjQYK3XIWVak8cfDzS3M793Rh Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="249110820" X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="249110820" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 01:19:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="541015555" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.151]) by orsmga008.jf.intel.com with SMTP; 09 Feb 2022 01:19:29 -0800 Received: by stinkbox (sSMTP sendmail emulation); Wed, 09 Feb 2022 11:19:28 +0200 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/atomic: Don't pollute crtc_state->mode_blob with error pointers Date: Wed, 9 Feb 2022 11:19:27 +0200 Message-Id: <20220209091928.14766-1-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fuyufan , intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä Make sure we don't assign an error pointer to crtc_state->mode_blob as that will break all kinds of places that assume either NULL or a valid pointer (eg. drm_property_blob_put()). Reported-by: fuyufan Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_atomic_uapi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index 9781722519c3..54d62fdb4ef9 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -76,15 +76,17 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, state->mode_blob = NULL; if (mode) { + struct drm_property_blob *blob; + drm_mode_convert_to_umode(&umode, mode); - state->mode_blob = - drm_property_create_blob(state->crtc->dev, - sizeof(umode), - &umode); - if (IS_ERR(state->mode_blob)) - return PTR_ERR(state->mode_blob); + blob = drm_property_create_blob(crtc->dev, + sizeof(umode), &umode); + if (IS_ERR(blob)) + return PTR_ERR(blob); drm_mode_copy(&state->mode, mode); + + state->mode_blob = blob; state->enable = true; drm_dbg_atomic(crtc->dev, "Set [MODE:%s] for [CRTC:%d:%s] state %p\n", From patchwork Wed Feb 9 09:19:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 12739899 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7018AC433EF for ; Wed, 9 Feb 2022 09:19:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E2A810E684; Wed, 9 Feb 2022 09:19:42 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9329A10E684; Wed, 9 Feb 2022 09:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644398381; x=1675934381; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+5ngPWnPIFLyTDOF/8itLf4N7yGPGRVVum2BWpz4u8c=; b=ZI1BkQRw0Pr2R6mCxgvPNSbVgmrDaP/HmAqJZGf295+fNI+lFpAGyHGl y/XwmKaq4YyBydfmOPMcxd0nhIrrpN2ewnRPuG1oTQad3HmKWUhBqtq5U CT3P3Mb85+6GmTMPfl1QOszYG6soJS2Ddzb5Uk7NfPxoFepznSudPksVe yvcTYbbqF3nHi9/pnHaTktf7B7c2xR2lhczkqoBzagMx9BssIB+YY95ah 18+EV5dMvKWTVEpvEzUeiqS8eC1bZ99HOgrMk0eICQTNV6GK/Fg5vahNh ZWGoTP3yGC6inDqEJAT7LVlgRnKBdqWkqSbGcSLCv+y/hBtznqCk3lm1x Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="247997431" X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="247997431" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 01:19:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="525919899" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.151]) by orsmga007.jf.intel.com with SMTP; 09 Feb 2022 01:19:32 -0800 Received: by stinkbox (sSMTP sendmail emulation); Wed, 09 Feb 2022 11:19:31 +0200 From: Ville Syrjala To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] drm/modes: Fix drm_mode_copy() docs Date: Wed, 9 Feb 2022 11:19:28 +0200 Message-Id: <20220209091928.14766-2-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220209091928.14766-1-ville.syrjala@linux.intel.com> References: <20220209091928.14766-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Ville Syrjälä There is no object id in drm_display_mode anymore. Remove stale comments to the contrary. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/drm_modes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 1c72208d8133..1f4d9cd188cc 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -880,7 +880,7 @@ EXPORT_SYMBOL(drm_mode_set_crtcinfo); * @dst: mode to overwrite * @src: mode to copy * - * Copy an existing mode into another mode, preserving the object id and + * Copy an existing mode into another mode, preserving * list head of the destination mode. */ void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src)