Commit 1c186d5f authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

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

if imx7_csi_try_fmt() fails, outcc variable won't be
initialized and csi->cc[IMX7_CSI_PAD_SRC] would be pointing
to a random location.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 2758d9a7
...@@ -980,7 +980,7 @@ static int imx7_csi_get_fmt(struct v4l2_subdev *sd, ...@@ -980,7 +980,7 @@ static int imx7_csi_get_fmt(struct v4l2_subdev *sd,
return ret; return ret;
} }
static void imx7_csi_try_fmt(struct imx7_csi *csi, static int imx7_csi_try_fmt(struct imx7_csi *csi,
struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *sdformat, struct v4l2_subdev_format *sdformat,
const struct imx_media_pixfmt **cc) const struct imx_media_pixfmt **cc)
...@@ -992,7 +992,7 @@ static void imx7_csi_try_fmt(struct imx7_csi *csi, ...@@ -992,7 +992,7 @@ static void imx7_csi_try_fmt(struct imx7_csi *csi,
in_fmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SINK, in_fmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SINK,
sdformat->which); sdformat->which);
if (!in_fmt) if (!in_fmt)
return; return -EINVAL;
switch (sdformat->pad) { switch (sdformat->pad) {
case IMX7_CSI_PAD_SRC: case IMX7_CSI_PAD_SRC:
...@@ -1023,8 +1023,10 @@ static void imx7_csi_try_fmt(struct imx7_csi *csi, ...@@ -1023,8 +1023,10 @@ static void imx7_csi_try_fmt(struct imx7_csi *csi,
false); false);
break; break;
default: default:
return -EINVAL;
break; break;
} }
return 0;
} }
static int imx7_csi_set_fmt(struct v4l2_subdev *sd, static int imx7_csi_set_fmt(struct v4l2_subdev *sd,
...@@ -1067,8 +1069,10 @@ static int imx7_csi_set_fmt(struct v4l2_subdev *sd, ...@@ -1067,8 +1069,10 @@ static int imx7_csi_set_fmt(struct v4l2_subdev *sd,
format.pad = IMX7_CSI_PAD_SRC; format.pad = IMX7_CSI_PAD_SRC;
format.which = sdformat->which; format.which = sdformat->which;
format.format = sdformat->format; format.format = sdformat->format;
imx7_csi_try_fmt(csi, cfg, &format, &outcc); if (imx7_csi_try_fmt(csi, cfg, &format, &outcc)) {
ret = -EINVAL;
goto out_unlock;
}
outfmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SRC, outfmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SRC,
sdformat->which); sdformat->which);
*outfmt = format.format; *outfmt = format.format;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment