From patchwork Wed Jun 21 22:33:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13288013 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 162D4EB64DC for ; Wed, 21 Jun 2023 22:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Qwis9PM8gtiVZI98dHfRxHdmk+XB5PlJT94M91HaLl0=; b=f+sQ69jPiAQh8zl1KfXAHRk01k G16CuVhLK0Rar172GBR+3clRrKnhaxeIndrc0V3r8kHDxKFy9hFzxNz8E9oswc8SzWECklFfTyzD4 QoYP22w+kZaoWGkh6SimOJjMO8F/WNw3RxTkgiRYdPitKFoyvjsqF6jt92WuoJ5EU8EEPlUQ0VmpV tofvqhPiudVA+QQK1gNZXyCRjWbDWQkQCWTvw7d1UZgKKG1NvQDuPF8Lef6z3IsYUGcZ4F++BJNZ5 byJn5zyJvbt1f1dO2F25GI/MMpTLW/Opz5I6RDxVuFduC8wR3yEkcrMxlSP/C5FSQAyzngsORVFQM 8SKiRPSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qC6OZ-00FvSQ-1L; Wed, 21 Jun 2023 22:33:47 +0000 Received: from s.wrqvwxzv.outbound-mail.sendgrid.net ([149.72.154.232]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qC6OA-00FvBC-2a for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 22:33:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=N3/rzRG3o23sD+ICspFZR3Hn+pKFLqALOJeNlqnKgj4=; b=odo6I7Jt7vJMGUnTiX003h/h8HEQt1HFOUB00tQROehfkL77cpEvY37AZmQGVQkAjjO1 +vExX5bMazjGKH1Kak0ROyBhP7gG4VQ4mKNf2kOPWts/wX01JJiYLvcURr4p8QRHMzLVYw enwvkMPNRdMtVo4za6tO8B/xk8FvH+GsScKALqG3YwK6BTRHLkek1QpTfgR+pADi1KPTW7 OtcUXI9ClAufLMKUWkoD1BYAoFBYNZogpZL4+Snt4P+unpFxwqsEqTxsbH+ieJc5kc8O09 H4x4ZykiaZS9cfKtysqt4m0I+DQuF6WWklCLiG9IMOeCUl+TZ4KK4iU2RBcOeFQA== Received: by filterdrecv-84b96456cb-hq7z7 with SMTP id filterdrecv-84b96456cb-hq7z7-1-64937AAF-22 2023-06-21 22:33:19.939834959 +0000 UTC m=+3624888.194376328 Received: from bionic.localdomain (unknown) by geopod-ismtpd-0 (SG) with ESMTP id ZVQYkneORxuup128izvcVw Wed, 21 Jun 2023 22:33:19.491 +0000 (UTC) From: Jonas Karlman Subject: [PATCH v2 3/5] drm/rockchip: vop: Fix call to crtc reset helper Date: Wed, 21 Jun 2023 22:33:20 +0000 (UTC) Message-ID: <20230621223311.2239547-4-jonas@kwiboo.se> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230621223311.2239547-1-jonas@kwiboo.se> References: <20230621223311.2239547-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0h8LrEgJzY5ktvBu14zmHPK0tdeaF/rED9ytrdgA/Zcc/ZBkGuBtyyJesjdWC3QvDOV0X9yW1R/VKEfNKLQZiqi2umm+dqbriEYRDImwY7HEZ51OgylcG39fUr/zBOUk52Ep1qOflYQL2wXTa2Imx5IU9iXaZ9oVR2AGhwRiPe8jDGZb4Dd2ndbd7q4OMxijV/w== To: Sandy Huang , Heiko Stuebner , David Airlie , Daniel Vetter , Maarten Lankhorst Cc: Mark Yao , Andy Yan , Sascha Hauer , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_153322_991018_6BD1F0DA X-CRM114-Status: GOOD ( 12.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allocation of crtc_state may fail in vop_crtc_reset, causing an invalid pointer to be passed to __drm_atomic_helper_crtc_reset. Fix this by adding a NULL check of crtc_state, similar to other drivers. Fixes: 01e2eaf40c9d ("drm/rockchip: Convert to using __drm_atomic_helper_crtc_reset() for reset.") Signed-off-by: Jonas Karlman Reviewed-by: Sascha Hauer --- v2: - New patch drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 25c873d4ff53..23bc79064e78 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1630,7 +1630,10 @@ static void vop_crtc_reset(struct drm_crtc *crtc) if (crtc->state) vop_crtc_destroy_state(crtc, crtc->state); - __drm_atomic_helper_crtc_reset(crtc, &crtc_state->base); + if (crtc_state) + __drm_atomic_helper_crtc_reset(crtc, &crtc_state->base); + else + __drm_atomic_helper_crtc_reset(crtc, NULL); } #ifdef CONFIG_DRM_ANALOGIX_DP