Thread (9 messages) 9 messages, 3 authors, 2021-11-08

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

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2021-11-08 16:12:38
Also in: alsa-devel, intel-gfx, linux-alpha, linux-arm-kernel, linux-clk, linux-crypto, linux-edac, linux-fbdev, linux-hyperv, linux-iio, linux-leds, linux-mips, linux-pm, linux-remoteproc, linux-renesas-soc, linux-s390, linux-scsi, linux-sh, linux-staging, linux-tegra, linux-um, linux-usb, lkml, netdev, rcu, sparclinux, xen-devel

Hi Borislav,

On Mon, Nov 8, 2021 at 4:59 PM Borislav Petkov [off-list ref] wrote:
On Mon, Nov 08, 2021 at 04:25:47PM +0100, Geert Uytterhoeven wrote:
quoted
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, then the registration
function should be void. IOW, those APIs are not optimally designed atm.
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,
  3. Return a __must_check error code: every caller must check.

I'm in favor of 2, as there are several places where it cannot fail.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help