lkml.org 
[lkml]   [2021]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] notifier: Return non-null when callback already registered
On Fri, May 21, 2021 at 01:11:42PM +0200, Peter Zijlstra wrote:
> > @@ -25,7 +25,7 @@ static int notifier_chain_register(struct notifier_block **nl,
> > while ((*nl) != NULL) {
> > if (unlikely((*nl) == n)) {
> > WARN(1, "double register detected");
>
> That should give a big clue^

Yah, the big cluebat... Was wondering whether to remove it, actually.
But then I'd need to audit all users whether they handle retval
properly. Sounds like a kernelnewbies project to me...

> > - return 0;
> > + return 1;
>
> How about -EBUSY here?

Yah, anthing but 0.

But if we're gonna return -E things, -EEXIST looks like an even better
fit to me...

Thx.

--
Regards/Gruss,
Boris.

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

\
 
 \ /
  Last update: 2021-05-21 16:07    [W:0.063 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site