[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=Mdxtx-wh3HGu+SNrCwfSq0PEm3fG7hK_6wPAk2uzk8xpA@mail.gmail.com>
Date: Thu, 22 Feb 2024 05:33:59 -0800
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, Bartosz Golaszewski <brgl@...ev.pl>
Subject: Re: [PATCH v1 1/1] gpiolib: Fix the error path order in gpiochip_add_data_with_key()
On Thu, 22 Feb 2024 14:25:24 +0100, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> said:
> On Thu, Feb 22, 2024 at 10:37:06AM +0100, Bartosz Golaszewski wrote:
>> 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.
>
>> > 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);
>> > of_gpiochip_remove(gc);
>>
>> This undoes machine_gpiochip_add() and I think it also needs to be
>> moved before acpi_gpiochip_remove().
>
> You mean it should be like
>
> gpiochip_irqchip_free_valid_mask(gc);
> gpiochip_free_hogs(gc);
> err_remove_acpi_chip:
> acpi_gpiochip_remove(gc);
> gpiochip_remove_pin_ranges(gc);
> err_remove_of_chip:
> of_gpiochip_remove(gc);
>
> ?
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
>
Yes, because the sequence is:
ret = of_gpiochip_add(gc);
if (ret)
goto err_cleanup_desc_srcu;
ret = gpiochip_add_pin_ranges(gc);
if (ret)
goto err_remove_of_chip;
acpi_gpiochip_add(gc);
machine_gpiochip_add(gc);
ret = gpiochip_irqchip_init_valid_mask(gc);
if (ret)
goto err_remove_acpi_chip;
Bartosz
Powered by blists - more mailing lists