drm/stm: ltdc: fix warning in ltdc_crtc_update_clut()
authorPhilippe CORNU <[email protected]>
Tue, 10 Apr 2018 13:53:12 +0000 (15:53 +0200)
committerPhilippe Cornu <[email protected]>
Thu, 19 Apr 2018 10:24:45 +0000 (12:24 +0200)
Fix the warning
"warn: variable dereferenced before check 'crtc' (see line 390)"
by removing unnecessary checks as ltdc_crtc_update_clut() is
only called from ltdc_crtc_atomic_flush() where crtc and
crtc->state are not NULL.

Many thanks to Dan Carpenter for the bug report
https://lists.freedesktop.org/archives/dri-devel/2018-February/166918.html

Signed-off-by: Philippe Cornu <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Reviewed-by: yannick fertre <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/stm/ltdc.c

index 061d2b6e51571370fec6b1857645be7d567c95df..e3121d9e42303b1b356540618311753e35e03dba 100644 (file)
@@ -392,9 +392,6 @@ static void ltdc_crtc_update_clut(struct drm_crtc *crtc)
        u32 val;
        int i;
 
-       if (!crtc || !crtc->state)
-               return;
-
        if (!crtc->state->color_mgmt_changed || !crtc->state->gamma_lut)
                return;