media: imx: imx7-media-csi: Drop unneeded pad checks
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 27 Jan 2023 01:21:57 +0000 (02:21 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Wed, 8 Feb 2023 08:06:07 +0000 (09:06 +0100)
The subdev core guarantees that the .set_fmt() operation is always
called with a valid pad. Drop the unneeded pad checks.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx8mm-beacon-kit
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Tested-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/nxp/imx7-media-csi.c

index 62232cd6775f6aa350ba62870793125b3f53cf88..1adf5c3392d98496437519d5393b1604c341fb8f 100644 (file)
@@ -1936,6 +1936,7 @@ static int imx7_csi_try_fmt(struct imx7_csi *csi,
                sdformat->format.quantization = in_fmt->quantization;
                sdformat->format.ycbcr_enc = in_fmt->ycbcr_enc;
                break;
+
        case IMX7_CSI_PAD_SINK:
                *cc = imx7_csi_find_mbus_format(sdformat->format.code);
                if (!*cc) {
@@ -1947,8 +1948,6 @@ static int imx7_csi_try_fmt(struct imx7_csi *csi,
                if (sdformat->format.field != V4L2_FIELD_INTERLACED)
                        sdformat->format.field = V4L2_FIELD_NONE;
                break;
-       default:
-               return -EINVAL;
        }
 
        imx7_csi_try_colorimetry(&sdformat->format);
@@ -1968,9 +1967,6 @@ static int imx7_csi_set_fmt(struct v4l2_subdev *sd,
        struct v4l2_subdev_format format;
        int ret = 0;
 
-       if (sdformat->pad >= IMX7_CSI_PADS_NUM)
-               return -EINVAL;
-
        mutex_lock(&csi->lock);
 
        if (csi->is_streaming) {