@@ -183,6 +183,9 @@ static int adv748x_csi2_get_format(struct v4l2_subdev *sd,
struct adv748x_state *state = tx->state;
struct v4l2_mbus_framefmt *mbusformat;
+ if (sdformat->pad != ADV748X_CSI2_SINK)
+ return -EINVAL;
+
mbusformat = adv748x_csi2_get_pad_format(sd, cfg, sdformat->pad,
sdformat->which);
if (!mbusformat)
@@ -206,6 +209,9 @@ static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
struct v4l2_mbus_framefmt *mbusformat;
int ret = 0;
+ if (sdformat->pad != ADV748X_CSI2_SINK)
+ return -EINVAL;
+
mbusformat = adv748x_csi2_get_pad_format(sd, cfg, sdformat->pad,
sdformat->which);
if (!mbusformat)
@@ -213,24 +219,8 @@ static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
mutex_lock(&state->mutex);
- if (sdformat->pad == ADV748X_CSI2_SOURCE) {
- const struct v4l2_mbus_framefmt *sink_fmt;
-
- sink_fmt = adv748x_csi2_get_pad_format(sd, cfg,
- ADV748X_CSI2_SINK,
- sdformat->which);
-
- if (!sink_fmt) {
- ret = -EINVAL;
- goto unlock;
- }
-
- sdformat->format = *sink_fmt;
- }
-
*mbusformat = sdformat->format;
-unlock:
mutex_unlock(&state->mutex);
return ret;