aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2021-01-07 23:54:58 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-01-27 15:49:21 +0100
commit25a6436002d3bf2cc7483d0bfcf4373c3552f375 (patch)
tree43ea0c6f7c93c537a3ef38ed86f4f7880301464e /drivers/media/v4l2-core
parentmedia: i2c/Kconfig: Select FWNODE for OV772x sensor (diff)
downloadlinux-dev-25a6436002d3bf2cc7483d0bfcf4373c3552f375.tar.xz
linux-dev-25a6436002d3bf2cc7483d0bfcf4373c3552f375.zip
media: v4l2-async: Safely unregister an non-registered async subdev
Make the V4L2 async framework a bit more robust by allowing to unregister a non-registered async subdev. Otherwise the v4l2_async_cleanup() will attempt to delete the async subdev from the subdev_list with the corresponding list_head not initialized. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r--drivers/media/v4l2-core/v4l2-async.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 3db8e2a92982..64643b169783 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -813,6 +813,9 @@ EXPORT_SYMBOL(v4l2_async_register_subdev);
void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)
{
+ if (!sd->async_list.next)
+ return;
+
mutex_lock(&list_lock);
__v4l2_async_notifier_unregister(sd->subdev_notifier);