linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-media@vger.kernel.org,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	linux-renesas-soc@vger.kernel.org,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	Sylwester Nawrocki <snawrocki@kernel.org>
Subject: Re: [PATCH 1/4] v4l: async: fix unbind error in v4l2_async_notifier_unregister()
Date: Tue, 15 Aug 2017 19:16:14 +0300	[thread overview]
Message-ID: <20170815161604.5qjrd3eas4tlvrt6@valkosipuli.retiisi.org.uk> (raw)
In-Reply-To: <20170730223158.14405-2-niklas.soderlund+renesas@ragnatech.se>

On Mon, Jul 31, 2017 at 12:31:55AM +0200, Niklas Söderlund wrote:
> The call to v4l2_async_cleanup() will set sd->asd to NULL so passing it
> to notifier->unbind() have no effect and leaves the notifier confused.
> Call the unbind() callback prior to cleaning up the subdevice to avoid
> this.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

This is a bugfix and worthy without any other patches and so should be
applied separately.

I think it'd be safer to store sd->asd locally and call the notifier unbind
with that. Now you're making changes to the order in which things work, and
that's not necessary to achieve the objective of passing the async subdev
pointer to the notifier.

With that changed,

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

> ---
>  drivers/media/v4l2-core/v4l2-async.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
> index 851f128eba2219ad..0acf288d7227ba97 100644
> --- a/drivers/media/v4l2-core/v4l2-async.c
> +++ b/drivers/media/v4l2-core/v4l2-async.c
> @@ -226,14 +226,14 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
>  
>  		d = get_device(sd->dev);
>  
> +		if (notifier->unbind)
> +			notifier->unbind(notifier, sd, sd->asd);
> +
>  		v4l2_async_cleanup(sd);
>  
>  		/* If we handled USB devices, we'd have to lock the parent too */
>  		device_release_driver(d);
>  
> -		if (notifier->unbind)
> -			notifier->unbind(notifier, sd, sd->asd);
> -
>  		/*
>  		 * Store device at the device cache, in order to call
>  		 * put_device() on the final step
> -- 
> 2.13.3
> 

-- 
Sakari Ailus
e-mail: sakari.ailus@iki.fi

  reply	other threads:[~2017-08-15 16:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-30 22:31 [PATCH 0/4] v4l: async: fixes for v4l2_async_notifier_unregister() Niklas Söderlund
2017-07-30 22:31 ` [PATCH 1/4] v4l: async: fix unbind error in v4l2_async_notifier_unregister() Niklas Söderlund
2017-08-15 16:16   ` Sakari Ailus [this message]
2017-08-18 11:15     ` Laurent Pinchart
2017-08-18 13:42       ` Niklas Söderlund
2017-08-18 13:49         ` Sakari Ailus
2017-08-18 11:13   ` Laurent Pinchart
2017-07-30 22:31 ` [PATCH 2/4] v4l: async: abort if memory allocation fails when unregistering notifiers Niklas Söderlund
2017-08-24 16:20   ` Sakari Ailus
2017-07-30 22:31 ` [PATCH 3/4] v4l: async: do not hold list_lock when re-probing devices Niklas Söderlund
2017-07-30 22:31 ` [PATCH 4/4] v4l: async: add comment about re-probing to v4l2_async_notifier_unregister() Niklas Söderlund
2017-08-15 16:09   ` Sakari Ailus
2017-08-18 11:20     ` Laurent Pinchart
2017-08-18 13:42       ` Niklas Söderlund
2017-08-23 19:03         ` Niklas Söderlund
2017-08-24  7:59           ` Hans Verkuil
2017-08-24 16:17             ` Sakari Ailus
2017-08-25  9:17               ` Hans Verkuil
2017-07-31  8:04 ` [PATCH 0/4] v4l: async: fixes for v4l2_async_notifier_unregister() Hans Verkuil

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=20170815161604.5qjrd3eas4tlvrt6@valkosipuli.retiisi.org.uk \
    --to=sakari.ailus@iki.fi \
    --cc=hverkuil@xs4all.nl \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=sakari.ailus@linux.intel.com \
    --cc=snawrocki@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).