Re: [PATCH 4/6] gpio: pisosr: Use devm_gpiochip_add_data() to simplify remove path

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

 



On Tue, Mar 07, 2023 at 11:55:11AM -0600, Andrew Davis wrote:
> On 3/7/23 11:44 AM, Andy Shevchenko wrote:
> > On Tue, Mar 07, 2023 at 10:54:30AM -0600, Andrew Davis wrote:
> > > Use devm version of gpiochip add function to handle removal for us.
> > > 
> > > While here update copyright and module author.

...

> > > -	mutex_destroy(&gpio->lock);
> > 
> > You need to wrap this into devm.
> 
> I was thinking that but it seems there is no such thing. Most drivers
> just ignore unwinding mutex_init() since it doesn't allocate anything.
> 
> mutex_destroy() is a NOP unless you are doing DEBUG builds were
> it sets a magic value to check for use-after-free issues.

In any case it's correct to destroy it.

See, how it's done, for example, here a82c7cf803d9 ("leds: is31fl319x: Wrap
mutex_destroy() for devm_add_action_or_rest()").

-- 
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