[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200826141615.GN1891694@smile.fi.intel.com>
Date: Wed, 26 Aug 2020 17:16:15 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andrzej Hajda <a.hajda@...sung.com>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH v1] driver core: Annotate dev_err_probe() with
__must_check
On Wed, Aug 26, 2020 at 01:23:40PM +0200, Andrzej Hajda wrote:
> On 26.08.2020 12:44, Andy Shevchenko wrote:
> > We have got already new users of this API which interpret it differently
> > and miss the opportunity to optimize their code.
> >
> > In order to avoid similar cases in the future, annotate dev_err_probe()
> > with __must_check.
>
>
> There are many cases where __must_check can be annoying, for example:
>
> ret = ...;
>
> if (ret < 0) {
>
> dev_err_probe(...);
>
> goto cleanup;
Can be
ret = dev_err_probe(...);
> }
>
>
> Or (less frequently):
>
> ptr = ...;
>
> if (IS_ERR(ptr)) {
>
> dev_err_probe(...);
>
> return ptr;
...which basically should be something like
return dev_err_probe_ptr(...);
> }
>
>
> Of course in both cases one can add workarounds, but I am not sure what
> is better.
Me neither, but definitely API in current state allows to make code suboptimal.
So, up to Greg and Rafael to decide.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists