[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YYkyUEqcsOwQMb1S@zn.tnic>
Date: Mon, 8 Nov 2021 15:21:04 +0100
From: Borislav Petkov <bp@...en8.de>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Arnd Bergmann <arnd@...db.de>,
Ayush Sawal <ayush.sawal@...lsio.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rohit Maheshwari <rohitm@...lsio.com>,
Steven Rostedt <rostedt@...dmis.org>,
Vinay Kumar Yadav <vinay.yadav@...lsio.com>,
ALSA Development Mailing List <alsa-devel@...a-project.org>,
bcm-kernel-feedback-list <bcm-kernel-feedback-list@...adcom.com>,
Intel Graphics Development <intel-gfx@...ts.freedesktop.org>,
intel-gvt-dev@...ts.freedesktop.org,
alpha <linux-alpha@...r.kernel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
linux-clk <linux-clk@...r.kernel.org>,
Linux Crypto Mailing List <linux-crypto@...r.kernel.org>,
linux-edac@...r.kernel.org,
Linux Fbdev development list <linux-fbdev@...r.kernel.org>,
linux-hyperv@...r.kernel.org, linux-iio@...r.kernel.org,
linux-leds <linux-leds@...r.kernel.org>,
"open list:BROADCOM NVRAM DRIVER" <linux-mips@...r.kernel.org>,
Parisc List <linux-parisc@...r.kernel.org>,
Linux PM list <linux-pm@...r.kernel.org>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
"open list:REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM"
<linux-remoteproc@...r.kernel.org>,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>,
linux-s390 <linux-s390@...r.kernel.org>,
scsi <linux-scsi@...r.kernel.org>,
Linux-sh list <linux-sh@...r.kernel.org>,
linux-staging@...ts.linux.dev,
linux-tegra <linux-tegra@...r.kernel.org>,
linux-um <linux-um@...ts.infradead.org>,
USB list <linux-usb@...r.kernel.org>,
"open list:TENSILICA XTENSA PORT (xtensa)"
<linux-xtensa@...ux-xtensa.org>, netdev <netdev@...r.kernel.org>,
openipmi-developer@...ts.sourceforge.net, rcu@...r.kernel.org,
sparclinux <sparclinux@...r.kernel.org>,
the arch/x86 maintainers <x86@...nel.org>,
xen-devel@...ts.xenproject.org
Subject: Re: [PATCH v0 42/42] notifier: Return an error when callback is
already registered
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 this where it cannot fail, and where nothing can
> be done in the very unlikely event that the call would ever start to
> fail.
This is an attempt to remove this WARN() hack in
notifier_chain_register() and have the function return a proper error
value instead of this "Currently always returns zero." which is bad
design.
Some of the registration functions around the tree check that retval and
some don't. So if "it cannot fail" those registration either should not
return a value or callers should check that return value - what we have
now doesn't make a whole lot of sense.
Oh, and then fixing this should avoid stuff like:
+ if (notifier_registered == false) {
+ mce_register_decode_chain(&amdgpu_bad_page_nb);
+ notifier_registered = true;
+ }
from propagating in the code.
The other idea I have is to add another indirection in
notifier_chain_register() which will check the *proper* return value of
a lower level __notifier_chain_register() and then issue that warning.
That would definitely avoid touch so many call sites.
Bottom line is: what we have now needs cleaning up.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists