[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=McBp6DQvYTQXwC8hNjpcuOe_TAnj4S__Q79b6wjgYkK8g@mail.gmail.com>
Date: Wed, 8 Mar 2023 11:27:50 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andrew Davis <afd@...com>
Cc: Andy Shevchenko <andy@...nel.org>,
Peter Tyser <ptyser@...-inc.com>,
Linus Walleij <linus.walleij@...aro.org>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/6] gpio: pisosr: Use devm_gpiochip_add_data() to
simplify remove path
On Tue, Mar 7, 2023 at 6:55 PM Andrew Davis <afd@...com> 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.
>
> Andrew
And this is precisely why it's useful to destroy it. :)
Bart
Powered by blists - more mailing lists