Re: [PATCH v1 1/1] gpiolib: Make gpiod_put() error pointer aware
From: Andy Shevchenko
Date: Mon Apr 07 2025 - 09:49:31 EST
On Mon, Apr 07, 2025 at 02:49:27PM +0200, Bartosz Golaszewski wrote:
> On Thu, Apr 3, 2025 at 3:22 PM Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
...
> I explained why I believe this change is wrong and I will allow myself
> to not accept it unless Linus is very positively in favor.
I am on the opposite site. With all burden on the users' shoulders...
And your _any deinit_ function example is wrong. This is not a deinit case,
this is resource allocation / reservation / etc and freeing it. Freeing
invalid resource is bad, freeing an optional resource, or resource which
has never been allocated — is okay. It makes device driver developer's life
easier. And many kernel APIs are written in that form. Since you again
pointed out that gpiod_get() is annotated, there is very unlikely somebody
deliberately will ignore those errors.
P.S.
I will continue insisting that this is an inconvenience (or bug) in gpiod_put().
--
With Best Regards,
Andy Shevchenko