提交 8e3fbfee 编写于 作者: L Laurent Pinchart 提交者: Mauro Carvalho Chehab

[media] v4l: async: Make it safe to unregister unregistered notifier

Calling v4l2_async_notifier_unregister() on a notifier that hasn't been
registered leads to a crash. To simplify drivers, make it safe to
unregister a notifier that has not been registered.
Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: NSylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: NSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
上级 3f359a7c
......@@ -192,6 +192,9 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
struct device *dev[n_subdev];
int i = 0;
if (!notifier->v4l2_dev)
return;
mutex_lock(&list_lock);
list_del(&notifier->list);
......@@ -225,6 +228,9 @@ void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
}
put_device(d);
}
notifier->v4l2_dev = NULL;
/*
* Don't care about the waiting list, it is initialised and populated
* upon notifier registration.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册