]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/rockchip: vop: Fix a dereferenced before check warning
authorAndy Yan <andy.yan@rock-chips.com>
Mon, 21 Oct 2024 07:28:06 +0000 (15:28 +0800)
committerHeiko Stuebner <heiko@sntech.de>
Sat, 9 Nov 2024 22:57:32 +0000 (23:57 +0100)
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>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20241021072818.61621-1-andyshrk@163.com
drivers/gpu/drm/rockchip/rockchip_drm_vop.c

index f161f40d8ce4c8a8395b3ef0b344e3a67ba3fb41..69900138295bf792a1002aff8d66a781082befb9 100644 (file)
@@ -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,