diff mbox series

drm/rockchip: vop: Fix a dereferenced before check warning

Message ID 20241021072818.61621-1-andyshrk@163.com (mailing list archive)
State New, archived
Headers show
Series drm/rockchip: vop: Fix a dereferenced before check warning | expand

Commit Message

Andy Yan Oct. 21, 2024, 7:28 a.m. UTC
From: Andy Yan <andy.yan@rock-chips.com>

The 'state' can't be NULL, we should check crtc_state.

Fix warning:
drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1096
vop_plane_atomic_async_check() warn: variable dereferenced before check
'state' (see line 1077)

Fixes: 5ddb0bd4ddc3 ("drm/atomic: Pass the full state to planes async atomic check and update")
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---

 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Heiko Stuebner Nov. 9, 2024, 11:38 p.m. UTC | #1
On Mon, 21 Oct 2024 15:28:06 +0800, Andy Yan wrote:
> From: Andy Yan <andy.yan@rock-chips.com>
> 
> The 'state' can't be NULL, we should check crtc_state.
> 
> Fix warning:
> drivers/gpu/drm/rockchip/rockchip_drm_vop.c:1096
> vop_plane_atomic_async_check() warn: variable dereferenced before check
> 'state' (see line 1077)
> 
> [...]

Applied, thanks!

[1/1] drm/rockchip: vop: Fix a dereferenced before check warning
      commit: ab1c793f457f740ab7108cc0b1340a402dbf484d

Best regards,
diff mbox series

Patch

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index a13473b2d54c..26aff9c5644e 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1093,10 +1093,10 @@  static int vop_plane_atomic_async_check(struct drm_plane *plane,
 	if (!plane->state->fb)
 		return -EINVAL;
 
-	if (state)
-		crtc_state = drm_atomic_get_existing_crtc_state(state,
-								new_plane_state->crtc);
-	else /* Special case for asynchronous cursor updates. */
+	crtc_state = drm_atomic_get_existing_crtc_state(state, new_plane_state->crtc);
+
+	/* Special case for asynchronous cursor updates. */
+	if (!crtc_state)
 		crtc_state = plane->crtc->state;
 
 	return drm_atomic_helper_check_plane_state(plane->state, crtc_state,