[media] media: adv7180: fill in mbus format in set_fmt
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Fri, 2 Sep 2016 16:44:56 +0000 (13:44 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 19 Sep 2016 19:31:04 +0000 (16:31 -0300)
If the V4L2_SUBDEV_FORMAT_TRY is used in set_fmt the width, height etc
would not be filled.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/i2c/adv7180.c

index a6ac78bef4f660e11b4381b9de88a887a57f7201..cbed2bc293255c58cb9c37f7ca0e2237346f6707 100644 (file)
@@ -711,6 +711,7 @@ static int adv7180_set_pad_format(struct v4l2_subdev *sd,
 {
        struct adv7180_state *state = to_state(sd);
        struct v4l2_mbus_framefmt *framefmt;
+       int ret;
 
        switch (format->format.field) {
        case V4L2_FIELD_NONE:
@@ -722,8 +723,9 @@ static int adv7180_set_pad_format(struct v4l2_subdev *sd,
                break;
        }
 
+       ret = adv7180_mbus_fmt(sd,  &format->format);
+
        if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
-               framefmt = &format->format;
                if (state->field != format->format.field) {
                        state->field = format->format.field;
                        adv7180_set_power(state, false);
@@ -735,7 +737,7 @@ static int adv7180_set_pad_format(struct v4l2_subdev *sd,
                *framefmt = format->format;
        }
 
-       return adv7180_mbus_fmt(sd, framefmt);
+       return ret;
 }
 
 static int adv7180_g_mbus_config(struct v4l2_subdev *sd,