[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45bb83c5ba33d479e1634e3a9efafcca5691fd9e.camel@ew.tq-group.com>
Date: Mon, 26 Jul 2021 14:18:42 +0200
From: Matthias Schiffer <matthias.schiffer@...tq-group.com>
To: Mark Brown <broonie@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
David Lechner <david@...hnology.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] regmap: do not call regmap_debugfs_init() from
regmap_attach_dev()
On Mon, 2021-07-26 at 13:11 +0100, Mark Brown wrote:
> * PGP Signed by an unknown key
>
> On Mon, Jul 26, 2021 at 02:01:51PM +0200, Matthias Schiffer wrote:
> > On Mon, 2021-07-26 at 12:47 +0100, Mark Brown wrote:
> > > The use case for regmap_attach_dev() is that there was no device when
> > > the regmap was initially instantiated due to it running very early, we
> > > want to attach the device when we figure out what it is which includes
> > > setting up the debugfs stuff. Whatever is managing to call this with
> > > the same device as has already been set is clearly not that use case.
> > I'm not talking about a case where regmap_attach_dev() is called when
> > there is already a device attached; as far as I can tell such a thing
> > does not happen in current kernel code.
>
> So in that case how are we managing to create a debugfs file with the
> same name given (which was the problem you were reporting) that the
> device name is embedded in the name of the debugfs file?
>
> > Please have a look at the commit in the Fixes: tag. The duplicate
> > regmap_debugfs_init() happens even when no device was passed in
> > __regmap_init(), so the regmap_attach_dev() is the first time a device
> > it attached.
>
> That's not what your patch says it's fixing, your patch says it's
> fixing an attempt to recreate the same directory as we had originally
> (we should probably clean up the one with no device but that's not what
> your commit does). I think what you need to look at here is that we
> store map->debugfs_name and don't overwrite it when the device is
> supplied.
>
That would be fine if regmap_debugfs_init() didn't do a lot more than
just create the debugfs directory. I'm more concerned about the mutex
and list head initialization that is happening on an already
initialized structure. I haven't looked in detail what the mutex and
list head are used for, but I assume bad thingsā¢ are going to happen
when someone is already holding the mutex or using the list.
Powered by blists - more mailing lists