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

From: Andy Shevchenko

Date: Tue Jun 09 2026 - 10:32:53 EST


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().

--
With Best Regards,
Andy Shevchenko