From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Andrzej Hajda <a.hajda@samsung.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Joe Perches <joe@perches.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Stephen Rothwell <sfr@canb.auug.org.au>
Subject: Re: [PATCH v1] driver core: Annotate dev_err_probe() with __must_check
Date: Wed, 9 Sep 2020 09:37:16 +0200 [thread overview]
Message-ID: <20200909073716.GA560912@kroah.com> (raw)
In-Reply-To: <CAJKOXPd=TfCNfHPdsQZ42VEcUZOFZroXg7xmA82zSA=AbADxKw@mail.gmail.com>
On Wed, Sep 09, 2020 at 09:08:14AM +0200, Krzysztof Kozlowski wrote:
> On Wed, 9 Sep 2020 at 09:02, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > On Wed, Sep 09, 2020 at 08:29:25AM +0200, Krzysztof Kozlowski wrote:
> > > On Wed, 26 Aug 2020 at 18:18, Joe Perches <joe@perches.com> wrote:
> > > >
> > > > On Wed, 2020-08-26 at 18:55 +0300, Andy Shevchenko wrote:
> > > > > On Wed, Aug 26, 2020 at 08:44:30AM -0700, Joe Perches wrote:
> > > > > > On Wed, 2020-08-26 at 13:44 +0300, Andy Shevchenko wrote:
> > > > >
> > > > > ...
> > > > >
> > > > > > > -int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
> > > > > > > +int __must_check dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
> > >
> > > +Cc Stephen and Greg,
> > >
> > > Hi Andy,
> > >
> > > Did this patch ended up in next somehow? I am surprised because now I
> > > got warnings for perfectly fine code:
> > > https://lore.kernel.org/linux-next/20200909155654.76fe3bd6@canb.auug.org.au/T/#u
> > >
> > > This creates simply false warnings instead of hints for "optimization".
> >
> > Yes, it got merged into m y driver core tree.
> >
> > I'll fix up the tty build warning, should be easy enough, the patch is
> > below.
>
> Yes, this fix suppresses the warning but the question is whether we
> really want the warning?
> Such fixes mean additional code which the compiler might not optimize
> (unless it inlines the dev_err_probe()). This additional code is
> purely for suppressing the warning, without any meaning on its own.
> Actually it might be even confusing for someone to see:
> if (ret)
> ret = dev_err_probe(ret);
Yeah, that is dumb, as the patch I made shows :(
> warn_unused_result should point errors, not "optimization
> opportunities". If you want to have opportunity, add a coccinelle
> rule. Or a checkpatch rule. Not a compiler warning.
Ok, I now agree, I'll go revert this patch and trust that driver authors
will "do the right thing" here...
thanks,
greg k-h
next prev parent reply other threads:[~2020-09-09 7:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200826104505eucas1p2e6ac15abfb6104fdbc4229fc148cbe02@eucas1p2.samsung.com>
2020-08-26 10:44 ` [PATCH v1] driver core: Annotate dev_err_probe() with __must_check Andy Shevchenko
2020-08-26 11:23 ` Andrzej Hajda
2020-08-26 14:16 ` Andy Shevchenko
2020-08-26 15:44 ` Joe Perches
2020-08-26 15:55 ` Andy Shevchenko
2020-08-26 16:14 ` Joe Perches
2020-09-09 6:29 ` Krzysztof Kozlowski
2020-09-09 7:02 ` Greg Kroah-Hartman
2020-09-09 7:08 ` Krzysztof Kozlowski
2020-09-09 7:37 ` Greg Kroah-Hartman [this message]
2020-09-09 8:46 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200909073716.GA560912@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=a.hajda@samsung.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=joe@perches.com \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox