public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: mt9p031: Drop bogus v4l2_subdev_get_try_crop() call from mt9p031_init_cfg()
@ 2022-11-20 14:13 Marek Vasut
  2022-11-20 18:52 ` Laurent Pinchart
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Vasut @ 2022-11-20 14:13 UTC (permalink / raw)
  To: linux-media
  Cc: Marek Vasut, Laurent Pinchart, Mauro Carvalho Chehab,
	Sakari Ailus, Stefan Riedmueller

The mt9p031_init_cfg() already calls __mt9p031_get_pad_crop(), which
correctly calls v4l2_subdev_get_try_crop() on V4L2_SUBDEV_FORMAT_TRY
or returns &mt9p031->crop on V4L2_SUBDEV_FORMAT_ACTIVE. No need to
call v4l2_subdev_get_try_crop() in mt9p031_init_cfg() again in case
of both V4L2_SUBDEV_FORMAT_TRY and V4L2_SUBDEV_FORMAT_ACTIVE.

This also fixes a splat generated by this call since commit
2ba3e38517f5a ("media: v4l: subdev: Fail graciously when getting try data for NULL state")
because v4l2_subdev_get_try_crop() is called with sd_state = NULL
in mt9p031_init_cfg().

Fixes: 69681cd041648 ("media: mt9p031: Move open subdev op init code into init_cfg")
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Stefan Riedmueller <s.riedmueller@phytec.de>
---
 drivers/media/i2c/mt9p031.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index 5f5caafe56887..4ffc2f6e7db47 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -708,7 +708,6 @@ static int mt9p031_init_cfg(struct v4l2_subdev *subdev,
 					     V4L2_SUBDEV_FORMAT_TRY;
 
 	crop = __mt9p031_get_pad_crop(mt9p031, sd_state, 0, which);
-	v4l2_subdev_get_try_crop(subdev, sd_state, 0);
 	crop->left = MT9P031_COLUMN_START_DEF;
 	crop->top = MT9P031_ROW_START_DEF;
 	crop->width = MT9P031_WINDOW_WIDTH_DEF;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: mt9p031: Drop bogus v4l2_subdev_get_try_crop() call from mt9p031_init_cfg()
  2022-11-20 14:13 [PATCH] media: mt9p031: Drop bogus v4l2_subdev_get_try_crop() call from mt9p031_init_cfg() Marek Vasut
@ 2022-11-20 18:52 ` Laurent Pinchart
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2022-11-20 18:52 UTC (permalink / raw)
  To: Marek Vasut
  Cc: linux-media, Mauro Carvalho Chehab, Sakari Ailus,
	Stefan Riedmueller

Hi Marek,

Thank you for the patch.

On Sun, Nov 20, 2022 at 03:13:04PM +0100, Marek Vasut wrote:
> The mt9p031_init_cfg() already calls __mt9p031_get_pad_crop(), which
> correctly calls v4l2_subdev_get_try_crop() on V4L2_SUBDEV_FORMAT_TRY
> or returns &mt9p031->crop on V4L2_SUBDEV_FORMAT_ACTIVE. No need to
> call v4l2_subdev_get_try_crop() in mt9p031_init_cfg() again in case
> of both V4L2_SUBDEV_FORMAT_TRY and V4L2_SUBDEV_FORMAT_ACTIVE.
> 
> This also fixes a splat generated by this call since commit
> 2ba3e38517f5a ("media: v4l: subdev: Fail graciously when getting try data for NULL state")
> because v4l2_subdev_get_try_crop() is called with sd_state = NULL
> in mt9p031_init_cfg().
> 
> Fixes: 69681cd041648 ("media: mt9p031: Move open subdev op init code into init_cfg")
> Signed-off-by: Marek Vasut <marex@denx.de>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Stefan Riedmueller <s.riedmueller@phytec.de>
> ---
>  drivers/media/i2c/mt9p031.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
> index 5f5caafe56887..4ffc2f6e7db47 100644
> --- a/drivers/media/i2c/mt9p031.c
> +++ b/drivers/media/i2c/mt9p031.c
> @@ -708,7 +708,6 @@ static int mt9p031_init_cfg(struct v4l2_subdev *subdev,
>  					     V4L2_SUBDEV_FORMAT_TRY;
>  
>  	crop = __mt9p031_get_pad_crop(mt9p031, sd_state, 0, which);
> -	v4l2_subdev_get_try_crop(subdev, sd_state, 0);
>  	crop->left = MT9P031_COLUMN_START_DEF;
>  	crop->top = MT9P031_ROW_START_DEF;
>  	crop->width = MT9P031_WINDOW_WIDTH_DEF;

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-20 18:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-20 14:13 [PATCH] media: mt9p031: Drop bogus v4l2_subdev_get_try_crop() call from mt9p031_init_cfg() Marek Vasut
2022-11-20 18:52 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox