[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=MdvYdx6x=gSiOZ3SXAdJORnqhsNW79G2c7wABofWARwFw@mail.gmail.com>
Date: Thu, 22 Feb 2024 10:37:06 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/1] gpiolib: Fix the error path order in gpiochip_add_data_with_key()
On Wed, Feb 21, 2024 at 8:28 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> After shuffling the code, error path wasn't updated correctly.
> Fix it here.
>
> Fixes: ba5c5effe02c ("gpio: initialize descriptor SRCU structure before adding OF-based chips")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
> drivers/gpio/gpiolib.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 4b4812bbcafd..1706edb3ee3f 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1056,6 +1056,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
> gpiochip_irqchip_free_valid_mask(gc);
> err_remove_acpi_chip:
> acpi_gpiochip_remove(gc);
> + gpiochip_remove_pin_ranges(gc);
> err_remove_of_chip:
> gpiochip_free_hogs(gc);
This undoes machine_gpiochip_add() and I think it also needs to be
moved before acpi_gpiochip_remove().
Bart
> of_gpiochip_remove(gc);
> @@ -1063,7 +1064,6 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
> for (i = 0; i < gdev->ngpio; i++)
> cleanup_srcu_struct(&gdev->descs[i].srcu);
> err_free_gpiochip_mask:
> - gpiochip_remove_pin_ranges(gc);
> gpiochip_free_valid_mask(gc);
> err_cleanup_gdev_srcu:
> cleanup_srcu_struct(&gdev->srcu);
> --
> 2.43.0.rc1.1.gbec44491f096
>
Powered by blists - more mailing lists