Re: [PATCH 1/3] gpio: of: Fix of_gpiochip_add() error path

From: Linus Walleij
Date: Thu Mar 28 2019 - 12:58:58 EST


On Thu, Mar 28, 2019 at 2:13 PM Geert Uytterhoeven
<geert+renesas@xxxxxxxxx> wrote:

> If the call to of_gpiochip_scan_gpios() in of_gpiochip_add() fails, no
> error handling is performed. This lead to the need of callers to call
> of_gpiochip_remove() on failure, which causes "BAD of_node_put() on ..."
> if the failure happened before the call to of_node_get().
>
> Fix this by adding proper error handling.
>
> Note that calling gpiochip_remove_pin_ranges() multiple times causes no
> harm: subsequent calls are a no-op.
>
> Fixes: dfbd379ba9b7431e ("gpio: of: Return error if gpio hog configuration failed")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Patch applied.

Yours,
Linus Walleij