Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: imx7-media-csi: don't store a floating pointer

if imx7_csi_try_fmt() fails, cc variable won't be
initialized and csi->cc[sdformat->pad] would be pointing
to a random location.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

authored by

Rui Miguel Silva and committed by
Mauro Carvalho Chehab
5eaa30ae 1fc79c4b

+3 -1
+3 -1
drivers/staging/media/imx/imx7-media-csi.c
··· 1051 1051 goto out_unlock; 1052 1052 } 1053 1053 1054 - imx7_csi_try_fmt(csi, cfg, sdformat, &cc); 1054 + ret = imx7_csi_try_fmt(csi, cfg, sdformat, &cc); 1055 + if (ret < 0) 1056 + goto out_unlock; 1055 1057 1056 1058 fmt = imx7_csi_get_format(csi, cfg, sdformat->pad, sdformat->which); 1057 1059 if (!fmt) {