Re: [PATCH] spi: Add missing error handling for CS GPIOs

From: Linus Walleij
Date: Mon Apr 08 2019 - 07:13:00 EST


On Wed, Apr 3, 2019 at 4:46 PM Geert Uytterhoeven
<geert+renesas@xxxxxxxxx> wrote:

> While devm_gpiod_get_index_optional() returns NULL if the GPIO is not
> present (i.e. -ENOENT), it may still return other error codes, like
> -EPROBE_DEFER. Currently these are not handled, leading to
> unrecoverable failures later in case of probe deferral:
>
> gpiod_set_consumer_name: invalid GPIO (errorpointer)
> gpiod_direction_output: invalid GPIO (errorpointer)
> gpiod_set_value_cansleep: invalid GPIO (errorpointer)
> gpiod_set_value_cansleep: invalid GPIO (errorpointer)
> gpiod_set_value_cansleep: invalid GPIO (errorpointer)
>
> Detect and propagate errors to fix this.
>
> Fixes: f3186dd876697e69 ("spi: Optionally use GPIO descriptors for CS GPIOs")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Good catch! Sorry for my bugs...
Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

Yours,
Linus Walleij