[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ywiwv8TZ5oomTuHK@axis.com>
Date: Fri, 26 Aug 2022 13:38:39 +0200
From: Vincent Whitchurch <vincent.whitchurch@...s.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
CC: Jonathan Cameron <jic23@...nel.org>, kernel <kernel@...s.com>,
Lars-Peter Clausen <lars@...afoo.de>,
Axel Jonsson <Axel.Jonsson@...s.com>,
linux-iio <linux-iio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] iio: adc: mcp320x: use device managed functions
On Thu, Aug 25, 2022 at 10:01:58PM +0200, Andy Shevchenko wrote:
> On Wed, Aug 24, 2022 at 1:46 PM Vincent Whitchurch
> <vincent.whitchurch@...s.com> wrote:
> >
> > Use devm_* functions in probe to remove some code and to make it easier
> > to add further calls to the probe function.
>
> ...
>
> > + mutex_init(&adc->lock);
>
> > + return devm_iio_device_register(&spi->dev, indio_dev);
>
> Do you still need to destroy the mutex? If so, you may not call devm_
> variant of iio_device_register() or you have to wrap mutex_destroy()
> accordingly.
mutex_destroy() is only used to ensure that mutex debugging catches
further use of the mutex. Isn't it rather overkill to add specific
cleanup to do only that, especially in this case when it's anyway going
to get freed immediately afterwards? The vast majority of IIO drivers
don't call mutex_destroy() (256 calls to mutex_init() in HEAD vs 12 to
mutex_destroy()).
Powered by blists - more mailing lists