Re: [PATCH 2/2] gpio: fix cleanup path on hog failure

From: Andy Shevchenko

Date: Tue Jun 09 2026 - 11:00:16 EST


On Tue, Jun 09, 2026 at 04:33:59PM +0200, Bartosz Golaszewski wrote:
> On Tue, Jun 9, 2026 at 4:25 PM Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > On Tue, Jun 09, 2026 at 02:17:50PM +0200, Bartosz Golaszewski wrote:
> > > If gpiochip_hog_lines() successfully processes some hogs but fails on
> > > a later one, the error handling path in gpiochip_add_data_with_key()
> > > jumps directly to err_remove_of_chip. This leaks resources allocated
> > > earlier for ACPI, interrupts and hogs that were successfully processed.
> > > Use the right label in error path.
> >
> > This seems legit, but there is still a problem with implementation of
> > gpiochip_hog_lines(). Ideally it should clean up the crap it left when it
> > poops. With that, this one will require a brand new label just before
> > acpi_gpiochip_remove().
>
> Let's get this to stable and then rework it better in v7.2?

Sure. With that idea in mind,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
(only patch 2/2).

--
With Best Regards,
Andy Shevchenko