Re: [PATCH v3 4/5] media: v4l2-subdev: v4l2_subdev_free_state() to accept a NULL state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tomi,

Thank you for the patch.

On Thu, Jun 10, 2021 at 12:49:02PM +0300, Tomi Valkeinen wrote:
> Make v4l2_subdev_free_state() accept a NULL state.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
> ---
>  drivers/media/v4l2-core/v4l2-subdev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index dacae53b68d5..25c80d6de23b 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -931,7 +931,8 @@ EXPORT_SYMBOL_GPL(v4l2_subdev_alloc_state);
>  
>  void v4l2_subdev_free_state(struct v4l2_subdev_state *state)
>  {
> -	kvfree(state->pads);
> +	if (state)
> +		kvfree(state->pads);
>  	kfree(state);

I'd write

	if (!state)
		return;

as I expect we'll have more code in the future.

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

>  }
>  EXPORT_SYMBOL_GPL(v4l2_subdev_free_state);

-- 
Regards,

Laurent Pinchart



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux