media: v4l: async: fix unbind error in v4l2_async_notifier_unregister()

The call to v4l2_async_cleanup() will set sd->asd to NULL so passing it to
notifier->unbind() has 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>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Niklas Söderlund 2017-10-02 16:16:52 -04:00 committed by Mauro Carvalho Chehab
parent 99b7a995a4
commit 633d185b72

View File

@ -206,11 +206,11 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
list_del(&notifier->list); list_del(&notifier->list);
list_for_each_entry_safe(sd, tmp, &notifier->done, async_list) { list_for_each_entry_safe(sd, tmp, &notifier->done, async_list) {
v4l2_async_cleanup(sd);
if (notifier->unbind) if (notifier->unbind)
notifier->unbind(notifier, sd, sd->asd); notifier->unbind(notifier, sd, sd->asd);
v4l2_async_cleanup(sd);
list_move(&sd->async_list, &subdev_list); list_move(&sd->async_list, &subdev_list);
} }
@ -268,11 +268,11 @@ void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)
list_add(&sd->asd->list, &notifier->waiting); list_add(&sd->asd->list, &notifier->waiting);
v4l2_async_cleanup(sd);
if (notifier->unbind) if (notifier->unbind)
notifier->unbind(notifier, sd, sd->asd); notifier->unbind(notifier, sd, sd->asd);
v4l2_async_cleanup(sd);
mutex_unlock(&list_lock); mutex_unlock(&list_lock);
} }
EXPORT_SYMBOL(v4l2_async_unregister_subdev); EXPORT_SYMBOL(v4l2_async_unregister_subdev);