Re: [PATCH] notifier: Return an error when a callback has already been registered

From: Borislav Petkov
Date: Thu Dec 02 2021 - 09:23:41 EST


On Thu, Dec 02, 2021 at 03:16:30PM +0100, Sebastian Andrzej Siewior wrote:
> > while ((*nl) != NULL) {
> > - if (unlikely((*nl) == n)) {
> > - WARN(1, "double register detected");
> > - return 0;
>
> This could be s/0/-EEXIST/ or do I miss something?

It is...

> I appreciate the updated warning with %ps!

Send peterz your thanks for that. :-)

> > - }
> > + if (unlikely((*nl) == n))
> > + return -EEXIST;
^^^^^^^^^^^^^^^

... right here.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette