mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Icenowy Zheng <zhengxingda@iscas.ac.cn>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Joey Lu <a0987203069@gmail.com>, Han Gao <gaohan@iscas.ac.cn>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Icenowy Zheng <uwu@icenowy.me>
Subject: Re: [PATCH v2 4/4] drm/verisilicon: check old state CRTC in plane atomic_disable
Date: Mon, 16 Nov 2026 14:42:06 +0100	[thread overview]
Message-ID: <9765be24-b9b4-46f4-bdf4-782cd6a551d2@suse.de> (raw)
In-Reply-To: <20261102075710.1286456-5-zhengxingda@iscas.ac.cn>

Hi

Am 02.11.26 um 08:57 schrieb Icenowy Zheng:
> As atomic_update hooks of both planes would utilize atomic_disable
> functions to disable the plane when it's set to invisible (even when
> technically enabled), the atomic_disable functions need to check whether
> the plane is really enabled before.

Why? Why not just disable the plane?

Also see my review of the other patch. Why not remove that disable call 
from atomic_update?

Best regards
Thomas

>
> Add such a check to prevent NULL dereference.
>
> Fixes: dbf21777caa8 ("drm: verisilicon: add a driver for Verisilicon display controllers")
> Fixes: 8c4ae2189125 ("drm: verisilicon: add support for cursor planes")
> Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
> ---
>   drivers/gpu/drm/verisilicon/vs_cursor_plane.c  | 13 ++++++++++---
>   drivers/gpu/drm/verisilicon/vs_primary_plane.c | 13 ++++++++++---
>   2 files changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> index 5295dc2f9ee2e..bee19b65b9a4e 100644
> --- a/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> +++ b/drivers/gpu/drm/verisilicon/vs_cursor_plane.c
> @@ -104,9 +104,16 @@ static void vs_cursor_plane_atomic_disable(struct drm_plane *plane,
>   	struct drm_plane_state *state = drm_atomic_get_old_plane_state(atomic_state,
>   								       plane);
>   	struct drm_crtc *crtc = state->crtc;
> -	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
> -	unsigned int output = vcrtc->id;
> -	struct vs_dc *dc = vcrtc->dc;
> +	struct vs_crtc *vcrtc;
> +	unsigned int output;
> +	struct vs_dc *dc;
> +
> +	if (!crtc)
> +		return;
> +
> +	vcrtc = drm_crtc_to_vs_crtc(crtc);
> +	output = vcrtc->id;
> +	dc = vcrtc->dc;
>   
>   	regmap_update_bits(dc->regs, VSDC_CURSOR_CONFIG(output),
>   			   VSDC_CURSOR_CONFIG_FMT_MASK,
> diff --git a/drivers/gpu/drm/verisilicon/vs_primary_plane.c b/drivers/gpu/drm/verisilicon/vs_primary_plane.c
> index e687313d6f057..01725e60e5fbd 100644
> --- a/drivers/gpu/drm/verisilicon/vs_primary_plane.c
> +++ b/drivers/gpu/drm/verisilicon/vs_primary_plane.c
> @@ -65,9 +65,16 @@ static void vs_primary_plane_atomic_disable(struct drm_plane *plane,
>   	struct drm_plane_state *state = drm_atomic_get_old_plane_state(atomic_state,
>   								       plane);
>   	struct drm_crtc *crtc = state->crtc;
> -	struct vs_crtc *vcrtc = drm_crtc_to_vs_crtc(crtc);
> -	unsigned int output = vcrtc->id;
> -	struct vs_dc *dc = vcrtc->dc;
> +	struct vs_crtc *vcrtc;
> +	unsigned int output;
> +	struct vs_dc *dc;
> +
> +	if (!crtc)
> +		return;
> +
> +	vcrtc = drm_crtc_to_vs_crtc(crtc);
> +	output = vcrtc->id;
> +	dc = vcrtc->dc;
>   
>   	regmap_clear_bits(dc->regs, VSDC_FB_CONFIG_EX(output),
>   			  VSDC_FB_CONFIG_EX_FB_EN);

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)



  reply	other threads:[~2026-11-16 13:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  7:57 [PATCH v2 0/4] drm/verisilicon: misc fixes Icenowy Zheng
2026-11-02  7:57 ` [PATCH v2 1/4] drm/verisilicon: disable the output before enabling it Icenowy Zheng
2026-11-02  7:57 ` [PATCH v2 2/4] drm/verisilicon: nuke planes' atomic_enable hooks Icenowy Zheng
2026-11-16 13:37   ` Thomas Zimmermann
2026-11-02  7:57 ` [PATCH v2 3/4] drm/verisilicon: fix DC8200 primary plane disable clearing FB_EN Icenowy Zheng
2026-11-02  7:57 ` [PATCH v2 4/4] drm/verisilicon: check old state CRTC in plane atomic_disable Icenowy Zheng
2026-11-16 13:42   ` Thomas Zimmermann [this message]
2026-11-12  7:46 ` [PATCH v2 0/4] drm/verisilicon: misc fixes Icenowy Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9765be24-b9b4-46f4-bdf4-782cd6a551d2@suse.de \
    --to=tzimmermann@suse.de \
    --cc=a0987203069@gmail.com \
    --cc=airlied@gmail.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gaohan@iscas.ac.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=uwu@icenowy.me \
    --cc=zhengxingda@iscas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®