Re: [PATCH] gpio: grgpio: Fix device removing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 20, 2022 at 2:33 PM Uwe Kleine-König
<u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
>
> If a platform device's remove callback returns non-zero, the device core
> emits a warning and still removes the device and calls the devm cleanup
> callbacks.
>
> So it's not save to not unregister the gpiochip because on the next request

safe

> to a gpio the driver accesses kfree()'d memory. Also if an irq triggers,

GPIO
IRQ

> the freed memory is accessed.
>
> Instead rely on the gpio framework to ensure that after gpiochip_remove()

GPIO

> all gpios are freed and so the corresponding irqs unmapped. (I'm think the

GPIOs
IRQs
are unmapped

I think

> gpio framework doesn't guarantee that, but that's a bug there and out of

GPIO

> scope for this gpio driver to fix that.)

GPIO

> This is a preparation for making platform remove callbacks return void.


...

What a bug are you seeing in the GPIO library? IIRC for IRQ over GPIO
the GPIO holds the module reference count as well as GPIO device
reference count. Am I wrong?

-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux