On 08/08/2013 05:04 PM, Laurent Pinchart wrote: > 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: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> Tested-by: Sylwester Nawrocki <s.nawrocki@xxxxxxxxxxx> Acked-by: Sylwester Nawrocki <s.nawrocki@xxxxxxxxxxx> > --- > drivers/media/v4l2-core/v4l2-async.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > Compared to v1, I've modified the NULL check to match the coding style used in > the rest of the file (!... instead of ... != NULL). > > diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c > index b350ab9..10bb62c 100644 > --- a/drivers/media/v4l2-core/v4l2-async.c > +++ b/drivers/media/v4l2-core/v4l2-async.c > @@ -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(¬ifier->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. > Regards, Sylwester -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html