From 8e8f8713eb33ae7fe3465a484d1f0d95f526ecbb Mon Sep 17 00:00:00 2001 From: Changhuang Liang Date: Thu, 17 Aug 2023 16:48:31 +0800 Subject: media: starfive: isp: Fix enum isp subdev code bug Fix enum isp subdev code bug. Signed-off-by: Changhuang Liang --- drivers/media/platform/starfive/v4l2_driver/stf_isp.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/media/platform/starfive/v4l2_driver/stf_isp.c b/drivers/media/platform/starfive/v4l2_driver/stf_isp.c index 0d01a9b59731..8b36e22ef583 100644 --- a/drivers/media/platform/starfive/v4l2_driver/stf_isp.c +++ b/drivers/media/platform/starfive/v4l2_driver/stf_isp.c @@ -715,21 +715,11 @@ static int isp_enum_mbus_code(struct v4l2_subdev *sd, struct stf_isp_dev *isp_dev = v4l2_get_subdevdata(sd); const struct isp_format_table *formats; - if (code->index >= isp_dev->nformats) + if (code->index >= isp_dev->formats[code->pad].nfmts) return -EINVAL; - if (code->pad == STF_ISP_PAD_SINK) { - formats = &isp_dev->formats[code->pad]; - code->code = formats->fmts[code->index].code; - } else { - struct v4l2_mbus_framefmt *sink_fmt; - - sink_fmt = __isp_get_format(isp_dev, state, STF_ISP_PAD_SINK, - code->which); - code->code = sink_fmt->code; - if (!code->code) - return -EINVAL; - } + formats = &isp_dev->formats[code->pad]; + code->code = formats->fmts[code->index].code; code->flags = 0; return 0; -- cgit v1.2.3