--- drivers/media/i2c/adv7604.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 30bbd9d..6ed9303 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -1976,7 +1976,11 @@ static int adv7604_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, if (format->which == V4L2_SUBDEV_FORMAT_TRY) { struct v4l2_mbus_framefmt *fmt; - fmt = v4l2_subdev_get_try_format(fh, format->pad); + fmt = (fh == NULL) ? NULL + : v4l2_subdev_get_try_format(fh, format->pad); + if (fmt == NULL) + return EINVAL; + format->format.code = fmt->code; } else { format->format.code = state->format->code; @@ -2008,7 +2012,11 @@ static int adv7604_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, if (format->which == V4L2_SUBDEV_FORMAT_TRY) { struct v4l2_mbus_framefmt *fmt; - fmt = v4l2_subdev_get_try_format(fh, format->pad); + fmt = (fh == NULL) ? NULL + : v4l2_subdev_get_try_format(fh, format->pad); + if (fmt == NULL) + return -EINVAL; + fmt->code = format->format.code; } else { state->format = info; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html