From: Rui Miguel Silva Date: Fri, 22 Feb 2019 10:17:10 +0000 (-0500) Subject: media: imx7-media-csi: don't store a floating pointer X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=5eaa30aedd7fc4e6a9f077b7ae5b42c9965d5b98;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Rui Miguel Silva Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 1ba62fcdcae8..18eb5d3ecf10 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -1051,7 +1051,9 @@ static int imx7_csi_set_fmt(struct v4l2_subdev *sd, goto out_unlock; } - imx7_csi_try_fmt(csi, cfg, sdformat, &cc); + ret = imx7_csi_try_fmt(csi, cfg, sdformat, &cc); + if (ret < 0) + goto out_unlock; fmt = imx7_csi_get_format(csi, cfg, sdformat->pad, sdformat->which); if (!fmt) {