From 633d185b7239a4b342bab4cc15a414f7d74635ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 2 Oct 2017 16:16:52 -0400 Subject: [PATCH] media: v4l: async: fix unbind error in v4l2_async_notifier_unregister() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Sakari Ailus Reviewed-by: Sebastian Reichel Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-async.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 21c748bf3a7b..ca281438a0ae 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -206,11 +206,11 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) list_del(¬ifier->list); list_for_each_entry_safe(sd, tmp, ¬ifier->done, async_list) { - v4l2_async_cleanup(sd); - if (notifier->unbind) notifier->unbind(notifier, sd, sd->asd); + v4l2_async_cleanup(sd); + 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, ¬ifier->waiting); - v4l2_async_cleanup(sd); - if (notifier->unbind) notifier->unbind(notifier, sd, sd->asd); + v4l2_async_cleanup(sd); + mutex_unlock(&list_lock); } EXPORT_SYMBOL(v4l2_async_unregister_subdev);