drm/stm: ltdc: fix warning in ltdc_crtc_update_clut()
authorPhilippe CORNU <philippe.cornu@st.com>
Tue, 10 Apr 2018 13:53:12 +0000 (15:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Aug 2018 05:48:01 +0000 (07:48 +0200)
[ Upstream commit c20f5f69c898899027c3e573afaab837195895b6 ]

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 <philippe.cornu@st.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: yannick fertre <yannick.fertre@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180410135312.3553-1-philippe.cornu@st.com
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/stm/ltdc.c

index 1a3277e483d529e3e8906806b7943588ead830fe..16e80308c6dbd05f18bc298a35c6ccb0196939e5 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;