Re: [PATCH v3] gpio: Fix resource leaks on errors in gpiochip_add_data_with_key()
From: Tzung-Bi Shih
Date: Sat Feb 28 2026 - 08:21:37 EST
On Fri, Feb 27, 2026 at 10:08:19AM +0100, Bartosz Golaszewski wrote:
>
> On Thu, 05 Feb 2026 09:28:40 +0000, Tzung-Bi Shih wrote:
> > Since commit aab5c6f20023 ("gpio: set device type for GPIO chips"),
> > `gdev->dev.release` is unset. As a result, the reference count to
> > `gdev->dev` isn't dropped on the error handling paths.
> >
> > Drop the reference on errors.
> >
> > Also reorder the instructions to make the error handling simpler.
> > Now gpiochip_add_data_with_key() roughly looks like:
> >
> > [...]
>
> Hi Tzung-Bi!
>
> For now I queued this for v7.1. I want it to spend some time in linux-next as
> I think it's a high-risk change. However, I preemptively put it into an
> immutable branch - if all is good for three weeks or so, I'll send it upstream
> for v7.0.
>
> I see you added a Fixes tag dating back to 2024 and Cc'ed stable. I'm afraid
> this change will not apply very far back, do you plan to backport it all the
> way to v6.8?
Probably no, I think the patch won't apply very far back as well. I added the
Fixes tag for providing context about the fix target.