* [PATCH 0/2] media: Fix build warnings with gcc-11 @ 2024-01-28 16:13 Ricardo Ribalda 2024-01-28 16:13 ` [PATCH 1/2] media: nxp: imx8-isi: Factor out a variable Ricardo Ribalda 2024-01-28 16:13 ` [PATCH 2/2] media: usb: s2255: Refactor s2255_get_fx2fw Ricardo Ribalda 0 siblings, 2 replies; 4+ messages in thread From: Ricardo Ribalda @ 2024-01-28 16:13 UTC (permalink / raw) To: Laurent Pinchart, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team Cc: linux-media, linux-arm-kernel, linux-kernel, Ricardo Ribalda gcc-11 throws some warnings, most of them are false positive... but with a simple refactor the code looks nicer and the warnings are gone. Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> --- Ricardo Ribalda (2): media: nxp: imx8-isi: Factor out a variable media: usb: s2255: Refactor s2255_get_fx2fw drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c | 8 +++----- drivers/media/usb/s2255/s2255drv.c | 7 ++++--- 2 files changed, 7 insertions(+), 8 deletions(-) --- base-commit: 615d300648869c774bd1fe54b4627bb0c20faed4 change-id: 20240128-gcc-11-warnings-15da5f29885f Best regards, -- Ricardo Ribalda <ribalda@chromium.org> _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] media: nxp: imx8-isi: Factor out a variable 2024-01-28 16:13 [PATCH 0/2] media: Fix build warnings with gcc-11 Ricardo Ribalda @ 2024-01-28 16:13 ` Ricardo Ribalda 2024-01-28 17:13 ` Laurent Pinchart 2024-01-28 16:13 ` [PATCH 2/2] media: usb: s2255: Refactor s2255_get_fx2fw Ricardo Ribalda 1 sibling, 1 reply; 4+ messages in thread From: Ricardo Ribalda @ 2024-01-28 16:13 UTC (permalink / raw) To: Laurent Pinchart, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team Cc: linux-media, linux-arm-kernel, linux-kernel, Ricardo Ribalda gcc-11 seems to believe that coffs can be used uninitialized. Refactor the code and remove the csen 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> --- drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c index 19e80b95ffea..5623914f95e6 100644 --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c @@ -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) -- 2.43.0.429.g432eaa2c6b-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] media: nxp: imx8-isi: Factor out a variable 2024-01-28 16:13 ` [PATCH 1/2] media: nxp: imx8-isi: Factor out a variable Ricardo Ribalda @ 2024-01-28 17:13 ` Laurent Pinchart 0 siblings, 0 replies; 4+ messages in thread From: Laurent Pinchart @ 2024-01-28 17:13 UTC (permalink / raw) To: Ricardo Ribalda Cc: Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, linux-media, linux-arm-kernel, linux-kernel Hi Ricardo, Thank you for the patch. On Sun, Jan 28, 2024 at 04:13:56PM +0000, Ricardo Ribalda wrote: > gcc-11 seems to believe that coffs can be used uninitialized. Refactor s/coffs/coeffs/ > the code and remove the csen variable to convince gcc that we are doing s/csen/cscen/ > 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> > --- > drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c > index 19e80b95ffea..5623914f95e6 100644 > --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c > +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-hw.c > @@ -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) > -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] media: usb: s2255: Refactor s2255_get_fx2fw 2024-01-28 16:13 [PATCH 0/2] media: Fix build warnings with gcc-11 Ricardo Ribalda 2024-01-28 16:13 ` [PATCH 1/2] media: nxp: imx8-isi: Factor out a variable Ricardo Ribalda @ 2024-01-28 16:13 ` Ricardo Ribalda 1 sibling, 0 replies; 4+ messages in thread From: Ricardo Ribalda @ 2024-01-28 16:13 UTC (permalink / raw) To: Laurent Pinchart, Mauro Carvalho Chehab, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team Cc: linux-media, linux-arm-kernel, linux-kernel, Ricardo Ribalda Resize the buffer to the actual size needed and initialize it. With this we can convince gcc-11 that the variable is not used uninitialized. drivers/media/usb/s2255/s2255drv.c:1914:25: warning: 'transBuffer' may be used uninitialized [-Wmaybe-uninitialized] Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> --- drivers/media/usb/s2255/s2255drv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 3c2627712fe9..8e1de1e8bd12 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -1906,9 +1906,10 @@ static int s2255_get_fx2fw(struct s2255_dev *dev) { int fw; int ret; - unsigned char transBuffer[64]; - ret = s2255_vendor_req(dev, S2255_VR_FW, 0, 0, transBuffer, 2, - S2255_VR_IN); + u8 transBuffer[2] = {}; + + ret = s2255_vendor_req(dev, S2255_VR_FW, 0, 0, transBuffer, + sizeof(transBuffer), S2255_VR_IN); if (ret < 0) dprintk(dev, 2, "get fw error: %x\n", ret); fw = transBuffer[0] + (transBuffer[1] << 8); -- 2.43.0.429.g432eaa2c6b-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-28 17:14 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-01-28 16:13 [PATCH 0/2] media: Fix build warnings with gcc-11 Ricardo Ribalda 2024-01-28 16:13 ` [PATCH 1/2] media: nxp: imx8-isi: Factor out a variable Ricardo Ribalda 2024-01-28 17:13 ` Laurent Pinchart 2024-01-28 16:13 ` [PATCH 2/2] media: usb: s2255: Refactor s2255_get_fx2fw Ricardo Ribalda
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).