media: nxp: imx8-isi: Factor out a variable
authorRicardo Ribalda <ribalda@chromium.org>
Sun, 28 Jan 2024 16:13:56 +0000 (16:13 +0000)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 5 Feb 2024 13:29:35 +0000 (14:29 +0100)
gcc-11 seems to believe that the coeffs variable can be used
uninitialized. Refactor the code and remove the cscen variable to
convince gcc that we are doing a good job.

drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c:218:20: warning: 'coeffs' may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20240128-gcc-11-warnings-v1-1-52bbdf492049@chromium.org
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c

index 19e80b95ffeaa39ce7c02366b30c97b34f31d08c..5623914f95e649000a353f4eb8ecc3b02e9a0a95 100644 (file)
@@ -215,8 +215,7 @@ static void mxc_isi_channel_set_csc(struct mxc_isi_pipe *pipe,
                [MXC_ISI_ENC_RGB] = "RGB",
                [MXC_ISI_ENC_YUV] = "YUV",
        };
-       const u32 *coeffs;
-       bool cscen = true;
+       const u32 *coeffs = NULL;
        u32 val;
 
        val = mxc_isi_read(pipe, CHNL_IMG_CTRL);
@@ -235,14 +234,13 @@ static void mxc_isi_channel_set_csc(struct mxc_isi_pipe *pipe,
                val |= CHNL_IMG_CTRL_CSC_MODE(CHNL_IMG_CTRL_CSC_MODE_RGB2YCBCR);
        } else {
                /* Bypass CSC */
-               cscen = false;
                val |= CHNL_IMG_CTRL_CSC_BYPASS;
        }
 
        dev_dbg(pipe->isi->dev, "CSC: %s -> %s\n",
                encodings[in_encoding], encodings[out_encoding]);
 
-       if (cscen) {
+       if (coeffs) {
                mxc_isi_write(pipe, CHNL_CSC_COEFF0, coeffs[0]);
                mxc_isi_write(pipe, CHNL_CSC_COEFF1, coeffs[1]);
                mxc_isi_write(pipe, CHNL_CSC_COEFF2, coeffs[2]);
@@ -253,7 +251,7 @@ static void mxc_isi_channel_set_csc(struct mxc_isi_pipe *pipe,
 
        mxc_isi_write(pipe, CHNL_IMG_CTRL, val);
 
-       *bypass = !cscen;
+       *bypass = !coeffs;
 }
 
 void mxc_isi_channel_set_alpha(struct mxc_isi_pipe *pipe, u8 alpha)