Skip to content

Commit

Permalink
media: ipu3-cio2: Return actual subdev format
Browse files Browse the repository at this point in the history
commit 8160e86 upstream.

Return actual subdev format on ipu3-cio2 subdev pads. The earlier
implementation was based on an infinite recursion that exhausted the
stack.

Reported-by: Tsuchiya Yuto <kitakar@gmail.com>
Fixes: c2a6a07 ("media: intel-ipu3: cio2: add new MIPI-CSI2 driver")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: stable@vger.kernel.org # v4.16 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Sakari Ailus authored and gregkh committed Dec 30, 2020
1 parent 6dbe445 commit 8a0f5b9
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions drivers/media/pci/intel/ipu3/ipu3-cio2.c
Expand Up @@ -1233,29 +1233,11 @@ static int cio2_subdev_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_format *fmt)
{
struct cio2_queue *q = container_of(sd, struct cio2_queue, subdev);
struct v4l2_subdev_format format;
int ret;

if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)
fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
return 0;
}

if (fmt->pad == CIO2_PAD_SINK) {
format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL,
&format);

if (ret)
return ret;
/* update colorspace etc */
q->subdev_fmt.colorspace = format.format.colorspace;
q->subdev_fmt.ycbcr_enc = format.format.ycbcr_enc;
q->subdev_fmt.quantization = format.format.quantization;
q->subdev_fmt.xfer_func = format.format.xfer_func;
}

fmt->format = q->subdev_fmt;
else
fmt->format = q->subdev_fmt;

return 0;
}
Expand Down

0 comments on commit 8a0f5b9

Please sign in to comment.