blob: 7f9c7cc2a3dc24ee57fb557895c386f960eb3451 [file] [log] [blame]
From 56b4b2d2a05140a3f3d68ec0573cb29e2177a364 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niklas=20S=C3=B6derlund?=
<niklas.soderlund+renesas@ragnatech.se>
Date: Mon, 2 Oct 2017 16:16:52 -0400
Subject: [PATCH 0287/1795] 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 <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>
(cherry picked from commit 633d185b7239a4b342bab4cc15a414f7d74635ad)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
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 590fbc9e63a9..325ec4062b4f 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -207,11 +207,11 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
list_del(&notifier->list);
list_for_each_entry_safe(sd, tmp, &notifier->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);
}
@@ -299,11 +299,11 @@ void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)
list_add(&sd->asd->list, &notifier->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);
--
2.19.0