struct ov5640_dev *sensor = to_ov5640_dev(sd);
        const struct ov5640_mode_info *new_mode;
        struct v4l2_mbus_framefmt *mbus_fmt = &format->format;
+       struct v4l2_mbus_framefmt *fmt;
        int ret;
 
        if (format->pad != 0)
        if (ret)
                goto out;
 
-       if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
-               struct v4l2_mbus_framefmt *fmt =
-                       v4l2_subdev_get_try_format(sd, cfg, 0);
+       if (format->which == V4L2_SUBDEV_FORMAT_TRY)
+               fmt = v4l2_subdev_get_try_format(sd, cfg, 0);
+       else
+               fmt = &sensor->fmt;
 
-               *fmt = *mbus_fmt;
-               goto out;
-       }
+       *fmt = *mbus_fmt;
 
        if (new_mode != sensor->current_mode) {
                sensor->current_mode = new_mode;
                sensor->pending_mode_change = true;
        }
-       if (mbus_fmt->code != sensor->fmt.code) {
-               sensor->fmt = *mbus_fmt;
+       if (mbus_fmt->code != sensor->fmt.code)
                sensor->pending_fmt_change = true;
-       }
+
 out:
        mutex_unlock(&sensor->lock);
        return ret;