linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: Eugen Hristev <eugen.hristev@microchip.com>
Cc: linux-media@vger.kernel.org, hverkuil@xs4all.nl,
	laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: v4l2-core: fix entity initialization in device_register_subdev
Date: Wed, 26 Feb 2020 16:59:00 +0200	[thread overview]
Message-ID: <20200226145900.GL5023@valkosipuli.retiisi.org.uk> (raw)
In-Reply-To: <20200226121545.19880-1-eugen.hristev@microchip.com>

Hi Eugen,

On Wed, Feb 26, 2020 at 02:15:45PM +0200, Eugen Hristev wrote:
> The check for parameters is done below in the function.
> Initialize the entity variable properly, after the parameters
> have been checked.
> 
> Fixes: 61f5db549dde ("[media] v4l: Make v4l2_subdev inherit from media_entity")
> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
> ---
>  drivers/media/v4l2-core/v4l2-device.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c
> index 63d6b147b21e..6e33132ebb19 100644
> --- a/drivers/media/v4l2-core/v4l2-device.c
> +++ b/drivers/media/v4l2-core/v4l2-device.c
> @@ -112,7 +112,7 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
>  				struct v4l2_subdev *sd)
>  {
>  #if defined(CONFIG_MEDIA_CONTROLLER)
> -	struct media_entity *entity = &sd->entity;
> +	struct media_entity *entity;
>  #endif
>  	int err;
>  
> @@ -141,6 +141,7 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
>  		goto error_module;
>  
>  #if defined(CONFIG_MEDIA_CONTROLLER)
> +	entity = &sd->entity;
>  	/* Register the entity. */
>  	if (v4l2_dev->mdev) {
>  		err = media_device_register_entity(v4l2_dev->mdev, entity);

Thanks for the patch.

Instead of keeping a shorthand for entity locally, I'd just refer to
&sd->entity. It's more simple, and gets away with one pair of #if / #endif
as well.

-- 
Regards,

Sakari Ailus

  reply	other threads:[~2020-02-26 15:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 12:15 [PATCH] media: v4l2-core: fix entity initialization in device_register_subdev Eugen Hristev
2020-02-26 14:59 ` Sakari Ailus [this message]
2020-02-26 15:02   ` Eugen.Hristev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200226145900.GL5023@valkosipuli.retiisi.org.uk \
    --to=sakari.ailus@iki.fi \
    --cc=eugen.hristev@microchip.com \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).