Messages in this thread | | | Date | Fri, 21 May 2021 13:11:42 +0200 | From | Peter Zijlstra <> | Subject | Re: [RFC PATCH] notifier: Return non-null when callback already registered |
| |
On Thu, May 20, 2021 at 10:20:33PM +0200, Borislav Petkov wrote: > From: Borislav Petkov <bp@suse.de> > > The notifier registration routine doesn't return a proper error value > when a callback has already been registered, leading people to track > whether that regisration has happened at the call site: > > https://lore.kernel.org/amd-gfx/20210512013058.6827-1-mukul.joshi@amd.com/ > > Which is unnecessary. > > Return a non-null to signal that case so that callers can act > accordingly. > > Signed-off-by: Borislav Petkov <bp@suse.de> > --- > kernel/notifier.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/kernel/notifier.c b/kernel/notifier.c > index 1b019cbca594..ff7a3198c5fc 100644 > --- a/kernel/notifier.c > +++ b/kernel/notifier.c > @@ -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^
> - return 0; > + return 1;
How about -EBUSY here?
| |