[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZhlqUdywIur4dzgE@smile.fi.intel.com>
Date: Fri, 12 Apr 2024 20:07:29 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Raag Jadav <raag.jadav@...el.com>, linux-kernel@...r.kernel.org,
kernel@...gutronix.de, "Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH] driver core: Make dev_err_probe() silent for -ENOMEM
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.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists