[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200419120304.GA3668771@kroah.com>
Date: Sun, 19 Apr 2020 14:03:04 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Joe Perches <joe@...ches.com>, Rafael Wysocki <rafael@...nel.org>,
Randy Dunlap <rdunlap@...radead.org>,
Matthew Wilcox <willy@...radead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
linux-input@...r.kernel.org, Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
linux-usb@...r.kernel.org,
"J. Bruce Fields" <bfields@...ldses.org>,
Chuck Lever <chuck.lever@...cle.com>,
"open list:NFS, SUNRPC, AND..." <linux-nfs@...r.kernel.org>,
Johannes Berg <johannes@...solutions.net>,
Dan Williams <dan.j.williams@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
linux-nvdimm <linux-nvdimm@...ts.01.org>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
linux-scsi <linux-scsi@...r.kernel.org>,
target-devel <target-devel@...r.kernel.org>,
Zzy Wysm <zzy@...wysm.com>
Subject: Re: [PATCH 7/9] drivers/base: fix empty-body warnings in
devcoredump.c
On Sat, Apr 18, 2020 at 12:15:57PM -0700, Linus Torvalds wrote:
> On Sat, Apr 18, 2020 at 11:57 AM Joe Perches <joe@...ches.com> wrote:
> >
> > sysfs_create_link is __must_check
>
> The way to handle __must_check if you really really don't want to test
> and have good reasons is
>
> (a) add a big comment about why this case ostensibly doesn't need the check
>
> (b) cast a test of it to '(void)' or something (I guess we could add
> a helper for this). So something like
>
> /* We will always clean up, we don't care whether this fails
> or succeeds */
> (void)!!sysfs_create_link(...)
>
> There are other alternatives (like using WARN_ON_ONCE() instead, for
> example). So it depends on the code. Which is why that comment is
> important to show why the code chose that option.
>
> However, I wonder if in this case we should just remove the
> __must_check. Greg? It goes back a long long time.
Yeah, maybe it is time to remove it, the gyrations people go through to
remove the warning when they "know" they are doing it right feels pretty
bad compared to forcing people to check things for "normal" calls to the
function.
thanks,
greg k-h
Powered by blists - more mailing lists