Re: [PATCH v16 17/32] v4l: async: Prepare for async sub-device notifiers

Sakari Ailus
2017-10-27T08:30:04Z

On Fri, Oct 27, 2017 at 10:10:02AM +0200, Niklas Söderlund wrote:
> > > @@ -151,6 +152,31 @@ static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
> > > return 0;
> > > }
> > >
> > > +/* Test all async sub-devices in a notifier for a match. */
> > > +static int v4l2_async_notifier_try_all_subdevs(
> > > + struct v4l2_async_notifier *notifier)
> > > +{
> > > + struct v4l2_device *v4l2_dev = notifier->v4l2_dev;
> > > + struct v4l2_subdev *sd, *tmp;
> > > +
> > > + list_for_each_entry_safe(sd, tmp, &subdev_list, async_list) {
> > > + struct v4l2_async_subdev *asd;
> > > + int ret;
> > > +
> > > + asd = v4l2_async_find_match(notifier, sd);
> > > + if (!asd)
> > > + continue;
> > > +
> > > + ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
> > > + if (ret < 0) {
> > > + mutex_unlock(&list_lock);
>
> The mutex should not be unlocked here, as the caller will also unlock it
> if ret is none zero. You fix this in 18/32 so the end result is OK but I
> think its better to fix this in this patch.

Good catch. I've sent v16.1 of these and forgot the change log. There are
no other changes than fixing this, i.e. the end result is the same.

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