Re: [PATCH v2 2/3] gpiolib: release the chip's own lines before numbing it on removal
From: Adrian Ambrozewicz
Date: Mon Nov 30 2026 - 05:16:20 EST
On Fri, Nov 27, 2026 at 05:42:50PM +0200, Andy Shevchenko wrote:
> This sounds like something is wrong in the cleanup flow. Why double free
> appears in the first place? Is the acpi_gpiochip_free_interrupts() call
> placed at incorrect function in the tear down flow?
Yes, it runs too late. The event lines are locked as IRQs, so
gpiochip_free_remaining_irqs(), which gpiochip_remove() calls right
before gpiochip_irqchip_remove(), frees their IRQs first. The
acpi_gpiochip_free_interrupts() call in gpiochip_irqchip_remove() then
frees them again. For v3 I plan to move that call out of
gpiochip_irqchip_remove() to before the numbing, with the chip's other
lines.
> Perhaps. I can't see it clearly in my mind, maybe when v3 is out it will
> be more obvious.
None of these bugs is new in v7.4, and the series has no Cc: stable,
so I plan to base v3 on gpio/for-next once it has v7.4-rc5, for the
chip-removal series, and to redo patch 1 there on top of commit
c402fd2961dd ("gpio: shared: factor out per-entry teardown helper"),
which it conflicts with today.
Bartosz, would you rather take them through gpio/for-current now? Then
I would post v3 on it, with that conflict described in the cover letter.