Message ID | 20240311121741.1249976-3-sakari.ailus@linux.intel.com |
---|---|
State | New |
Headers | show |
Series | None | expand |
Hi Sakari, I suppose on of your intentions of this series is to replace my patch, no? Am Montag, 11. März 2024, 13:17:41 CET schrieb Sakari Ailus: > Properly check that a notifier was never initialised or register. This can > now be done by looking at the entry in the notifier list, not the V4L2 > device or sub-device that are set in the initialiser now. > > Fixes: b8ec754ae4c5 ("media: v4l: async: Set v4l2_device and subdev in async notifier init") > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > --- > drivers/media/v4l2-core/v4l2-async.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c > index 2ff35d5d60f2..3b43d6285dfe 100644 > --- a/drivers/media/v4l2-core/v4l2-async.c > +++ b/drivers/media/v4l2-core/v4l2-async.c > @@ -630,12 +630,14 @@ EXPORT_SYMBOL(v4l2_async_nf_register); > static void > __v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier) > { > - if (!notifier || (!notifier->v4l2_dev && !notifier->sd)) > + /* Return here if the notifier is never initialised or registered. */ > + if (!notifier->notifier_entry.next || I don't like the idea checking the next pointer of a list. Despite that it's not even necessary. Best regards, Alexander > + list_empty(¬ifier->notifier_entry)) > return; > > v4l2_async_nf_unbind_all_subdevs(notifier); > > - list_del(¬ifier->notifier_entry); > + list_del_init(¬ifier->notifier_entry); > } > > void v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier) >
Hi Sakari, Am Mittwoch, 20. März 2024, 08:07:51 CET schrieb Sakari Ailus: > Hi Alexander, > > On Thu, Mar 14, 2024 at 03:04:44PM +0100, Alexander Stein wrote: > > Hi Sakari, > > > > I suppose on of your intentions of this series is to replace my patch, no? > > No, these are somewhat unrelated issues. Okay, thanks for confirmation. > > > > Am Montag, 11. März 2024, 13:17:41 CET schrieb Sakari Ailus: > > > Properly check that a notifier was never initialised or register. This can > > > now be done by looking at the entry in the notifier list, not the V4L2 > > > device or sub-device that are set in the initialiser now. > > > > > > Fixes: b8ec754ae4c5 ("media: v4l: async: Set v4l2_device and subdev in async notifier init") > > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > > > --- > > > drivers/media/v4l2-core/v4l2-async.c | 6 ++++-- > > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c > > > index 2ff35d5d60f2..3b43d6285dfe 100644 > > > --- a/drivers/media/v4l2-core/v4l2-async.c > > > +++ b/drivers/media/v4l2-core/v4l2-async.c > > > @@ -630,12 +630,14 @@ EXPORT_SYMBOL(v4l2_async_nf_register); > > > static void > > > __v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier) > > > { > > > - if (!notifier || (!notifier->v4l2_dev && !notifier->sd)) > > > + /* Return here if the notifier is never initialised or registered. */ > > > + if (!notifier->notifier_entry.next || > > > > I don't like the idea checking the next pointer of a list. > > Despite that it's not even necessary. > > Actually I think we can drop the above change. But the list_del_init() > below is still necessary. I agree about the list_del_init() change. Best regards, Alexander > > > > Best regards, > > Alexander > > > > > + list_empty(¬ifier->notifier_entry)) > > > return; > > > > > > v4l2_async_nf_unbind_all_subdevs(notifier); > > > > > > - list_del(¬ifier->notifier_entry); > > > + list_del_init(¬ifier->notifier_entry); > > > } > > > > > > void v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier) > > > > > > > > >
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 2ff35d5d60f2..3b43d6285dfe 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -630,12 +630,14 @@ EXPORT_SYMBOL(v4l2_async_nf_register); static void __v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier) { - if (!notifier || (!notifier->v4l2_dev && !notifier->sd)) + /* Return here if the notifier is never initialised or registered. */ + if (!notifier->notifier_entry.next || + list_empty(¬ifier->notifier_entry)) return; v4l2_async_nf_unbind_all_subdevs(notifier); - list_del(¬ifier->notifier_entry); + list_del_init(¬ifier->notifier_entry); } void v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier)
Properly check that a notifier was never initialised or register. This can now be done by looking at the entry in the notifier list, not the V4L2 device or sub-device that are set in the initialiser now. Fixes: b8ec754ae4c5 ("media: v4l: async: Set v4l2_device and subdev in async notifier init") Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> --- drivers/media/v4l2-core/v4l2-async.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)