Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls

From: Linus Walleij
Date: Thu Mar 23 2017 - 05:32:09 EST


On Mon, Mar 20, 2017 at 12:07 PM, Uwe Kleine-KÃnig
<u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
> Hello Geert,
>
> On Mon, Mar 20, 2017 at 11:38:52AM +0100, Geert Uytterhoeven wrote:
>> On Mon, Mar 20, 2017 at 11:31 AM, Uwe Kleine-KÃnig
>> <u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
>> > On Mon, Mar 20, 2017 at 10:56:14AM +0100, Geert Uytterhoeven wrote:
>> >> Documentation/gpio/consumer.txt rightfully sates:
>> >> | Note that gpio_get*_optional() functions (and their managed variants), unlike
>> >> | the rest of gpiolib API, also return NULL when gpiolib support is disabled.
>> >> | This is helpful to driver authors, since they do not need to special case
>> >> | -ENOSYS return codes. System integrators should however be careful to enable
>> >> | gpiolib on systems that need it.
>> >
>> > I cannot find this paragraph in Documentation/gpio/consumer.txt:
>> >
>> > $ git grep -e 'ENOSYS' v4.11-rc3 -- Documentation/gpio/
>> > <void>
>>
>> It was added by commit 22c403676dbbb7c6 ("gpio: return NULL from
>> gpiod_get_optional when GPIOLIB is disabled")
>
> Ah, that's in next.
>
> I still think this is wrong and I'm a bit disappointed that Linus merged
> this patch (without saying so in the thread even) as I thought Linus and
> I agreed on this being a bad idea.

I think it is not good, but what we have before this patch is worse.

I.e. it is the lesser evil.

Before this patch the API is inconsistent: it gives NULL if GPIOLIB
is defined and -ENOSYS if GPIOLIB is not defined.

After this patch it gives NULL in both cases, and that is at least
consistent.

It would be great if someone steps in and fix it so as to return
relevant errors (or error pointers rather) in both cases. However
I guess it will lead a bunch of fallouts in the consumers, albeit
they are not super-many.

Yours,
Linus Walleij