Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
On Mon, Nov 08, 2021 at 03:59:26PM -0500, Alan Stern wrote: > Is there really any reason for returning an error code? For example, is > it anticipated that at some point in the future these registration calls > might fail? > > Currently, the only reason for failing... Right, I believe with

Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Alan Stern
On Mon, Nov 08, 2021 at 05:21:45PM +0100, Borislav Petkov wrote: > On Mon, Nov 08, 2021 at 05:12:16PM +0100, Geert Uytterhoeven wrote: > > Returning void is the other extreme ;-) > > > > There are 3 levels (ignoring BUG_ON()/panic () inside the callee): > > 1. Return void: no one can check

Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
On Mon, Nov 08, 2021 at 05:12:16PM +0100, Geert Uytterhoeven wrote: > Returning void is the other extreme ;-) > > There are 3 levels (ignoring BUG_ON()/panic () inside the callee): > 1. Return void: no one can check success or failure, > 2. Return an error code: up to the caller to decide, >

Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Geert Uytterhoeven
Hi Borislav, On Mon, Nov 8, 2021 at 4:59 PM Borislav Petkov wrote: > On Mon, Nov 08, 2021 at 04:25:47PM +0100, Geert Uytterhoeven wrote: > > I'm not against returning proper errors codes. I'm against forcing > > callers to check things that cannot fail and to add individual error > > printing

Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
On Mon, Nov 08, 2021 at 04:25:47PM +0100, Geert Uytterhoeven wrote: > I'm not against returning proper errors codes. I'm against forcing > callers to check things that cannot fail and to add individual error > printing to each and every caller. If you're against checking things at the callers,

Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Geert Uytterhoeven
Hi Borislav, On Mon, Nov 8, 2021 at 3:21 PM Borislav Petkov wrote: > On Mon, Nov 08, 2021 at 03:07:03PM +0100, Geert Uytterhoeven wrote: > > I think the addition of __must_check is overkill, leading to the > > addition of useless error checks and message printing. > > See the WARN in

Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
On Mon, Nov 08, 2021 at 03:07:03PM +0100, Geert Uytterhoeven wrote: > I think the addition of __must_check is overkill, leading to the > addition of useless error checks and message printing. See the WARN in notifier_chain_register() - it will already do "message printing". > Many callers call

Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Geert Uytterhoeven
Hi Borislav, On Mon, Nov 8, 2021 at 11:13 AM Borislav Petkov wrote: > From: Borislav Petkov > > The notifier registration routine doesn't return a proper error value > when a callback has already been registered, leading people to track > whether that registration has happened at the call site:

[PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
From: Borislav Petkov The notifier registration routine doesn't return a proper error value when a callback has already been registered, leading people to track whether that registration has happened at the call site: https://lore.kernel.org/amd-gfx/20210512013058.6827-1-mukul.jo...@amd.com/