Re: [PATCH v7 7/8] gpiolib: let the character device free its IRQs first on chip removal

From: Kent Gibson

Date: Sat Nov 21 2026 - 00:26:51 EST


On Sat, Nov 21, 2026 at 07:19:01AM +0200, Adrian Ambrozewicz wrote:
> On Sat, Nov 21, 2026 at 12:46:57PM +0800, Kent Gibson wrote:
> > > @@ -1690,7 +1697,6 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip)
> > > return -ENOMEM;
> > > }
> > >
> > > - mutex_init(&lr->config_mutex);
> >
> > What is the rationale for relocating the mutex_init()?
> > Looks like a gratuitous change, and if this patch is going to be
> > backported then it should be kept minimal.
>
> It is needed: linereq_free() now takes config_mutex, and __free() also
> calls it when linereq_create() fails after allocating lr. The first such
> failure, kstrndup(), returned before the old mutex_init(), so it would
> have locked an uninitialised mutex. I plan to say so in the commit
> message in v8.
>

Ahh, I overlooked the __free(). That makes sense then.

Cheers,
Kent.

> > The lines removed/guarded were added in patch 3, so note that this patch is
> > dependent on patch 3 in the description[1].
> [...]
> > The line removed/guarded was added in patch 5, so note that this patch is
> > dependent on patch 5 in the description[1].
>
> Agreed, I plan to note both dependencies in the v8 description.
>
> Thanks for the review.
>
> Adrian