[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <s7y4v374dah2vjr7tv5eefaqolic6m5ns2d7qh2b272klhrlg6@scxsa625ylf5>
Date: Fri, 3 Jan 2025 11:29:36 +0900
From: Koichiro Den <koichiro.den@...onical.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: linux-gpio@...r.kernel.org, linus.walleij@...aro.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] gpio: virtuser: fix missing lookup table cleanup on
probe failure
On Thu, Jan 02, 2025 at 01:56:34PM +0100, Bartosz Golaszewski wrote:
> On Tue, Dec 24, 2024 at 7:08 AM Koichiro Den <koichiro.den@...onical.com> wrote:
> >
> > When a virtuser device is created via configfs and the probe fails due
> > to an incorrect lookup table, the table is not removed. This prevents
> > subsequent probe attempts from succeeding, even if the issue is
> > corrected, unless the device is released.
> >
> > Ensure the lookup table is removed whenever the probe fails.
> >
> > Fixes: 91581c4b3f29 ("gpio: virtuser: new virtual testing driver for the GPIO API")
> > Signed-off-by: Koichiro Den <koichiro.den@...onical.com>
> > ---
> > drivers/gpio/gpio-virtuser.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpio/gpio-virtuser.c b/drivers/gpio/gpio-virtuser.c
> > index 91b6352c957c..a81e15a4b807 100644
> > --- a/drivers/gpio/gpio-virtuser.c
> > +++ b/drivers/gpio/gpio-virtuser.c
> > @@ -1509,6 +1509,7 @@ gpio_virtuser_device_activate(struct gpio_virtuser_device *dev)
> > if (!dev->driver_bound) {
> > platform_device_unregister(pdev);
> > fwnode_remove_software_node(swnode);
> > + gpiod_remove_lookup_table(dev->lookup_table);
> > return -ENXIO;
> > }
> >
> > --
> > 2.43.0
> >
>
> Good catch! Don't we need to do the same if the call to
> platform_device_register_full() fails?
You're absolutely right. I also realized that I need to kfree the
lookup_table.
Thanks for the review! I'll fix this and send v2 shortly.
-Koichiro
>
> Bart
Powered by blists - more mailing lists