From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Raag Jadav <raag.jadav@intel.com>,
linux-kernel@vger.kernel.org, kernel@pengutronix.de,
"Rafael J. Wysocki" <rafael@kernel.org>
Subject: Re: [PATCH] driver core: Make dev_err_probe() silent for -ENOMEM
Date: Fri, 12 Apr 2024 20:53:03 +0300 [thread overview]
Message-ID: <Zhl0_8whWU1ftFeJ@smile.fi.intel.com> (raw)
In-Reply-To: <zjk3vnydp2yip343khmkq7v5vqbib6d6eyee6tx6h5nph4blzn@c26yrw2cqrt7>
On Fri, Apr 12, 2024 at 07:47:43PM +0200, Uwe Kleine-König wrote:
> On Fri, Apr 12, 2024 at 08:07:29PM +0300, Andy Shevchenko wrote:
> > On Fri, Apr 12, 2024 at 07:03:01PM +0200, Uwe Kleine-König wrote:
> > > On Fri, Apr 12, 2024 at 07:51:48PM +0300, Andy Shevchenko wrote:
> > > > On Fri, Apr 12, 2024 at 06:44:05PM +0200, Uwe Kleine-König wrote:
> > > > > For an out-of-memory error there should be no additional output. Adapt
> > > > > dev_err_probe() to not emit the error message when err is -ENOMEM.
> > > > > This simplifies handling errors that might among others be -ENOMEM.
...
> > > > BUILD_BUG_ON(err == -ENOMEM);
> > > >
> > > > Done!
> > >
> > > Well no, that doesn't do the trick. Consider for example device_add().
> > > That function can return (at least) -EINVAL and -ENOMEM. To properly
> > > ensure that the error handling is silent with the current
> > > dev_err_probe(), we'd need to do:
> > >
> > > ret = device_add(...);
> > > if (ret) {
> > > if (ret != -ENOMEM)
> > > return dev_err_probe(...);
> > > else
> > > return ret;
> > > }
> > >
> > > With my suggested patch this can be reduced to:
> > >
> > > ret = device_add(...);
> > > if (ret)
> > > return dev_err_probe(...);
> >
> > Fair enough, but these two should be combined.
> > Mine is for the rejecting a dead code on the phase of the submission.
>
> So something like the following on top of my change (only compile
> tested):
Hmm, but why macro? Shouldn't compiler be clever enough to see it even for
the exported function?
...
> I don't know if the kernel doc for dev_err_probe() should move to
> include/linux/dev_printk.h then?!
Not if you mark it for the __ variant.
But it has other kernel-doc formatting issues...
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-04-12 17:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-12 16:44 [PATCH] driver core: Make dev_err_probe() silent for -ENOMEM Uwe Kleine-König
2024-04-12 16:51 ` Andy Shevchenko
2024-04-12 17:03 ` Uwe Kleine-König
2024-04-12 17:07 ` Andy Shevchenko
2024-04-12 17:47 ` Uwe Kleine-König
2024-04-12 17:53 ` Andy Shevchenko [this message]
2024-04-12 20:30 ` Uwe Kleine-König
2024-04-12 16:54 ` Uwe Kleine-König
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=Zhl0_8whWU1ftFeJ@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=raag.jadav@intel.com \
--cc=rafael@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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