[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025021121-chaps-jawline-caf5@gregkh>
Date: Tue, 11 Feb 2025 09:17:06 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Kurt Borja <kuurtb@...il.com>
Cc: linux-kernel@...r.kernel.org, Lyude Paul <lyude@...hat.com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Danilo Krummrich <dakr@...nel.org>,
Alexander Lobakin <aleksander.lobakin@...el.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Liam Girdwood <lgirdwood@...il.com>, Lukas Wunner <lukas@...ner.de>,
Mark Brown <broonie@...nel.org>,
Maíra Canal <mairacanal@...eup.net>,
Robin Murphy <robin.murphy@....com>,
Simona Vetter <simona.vetter@...ll.ch>,
Zijun Hu <quic_zijuhu@...cinc.com>, linux-usb@...r.kernel.org,
rust-for-linux@...r.kernel.org,
Thomas Weißschuh <thomas.weissschuh@...utronix.de>
Subject: Re: [PATCH v4 1/9] driver core: add a faux bus for use when a simple
device/bus is needed
On Tue, Feb 11, 2025 at 02:43:20AM -0500, Kurt Borja wrote:
> On Tue Feb 11, 2025 at 2:33 AM -05, Greg Kroah-Hartman wrote:
> > On Tue, Feb 11, 2025 at 08:27:26AM +0100, Greg Kroah-Hartman wrote:
> >> On Mon, Feb 10, 2025 at 12:56:46PM -0500, Kurt Borja wrote:
> >> I'll work on adding "if probe failed, don't let the device be created"
> >> logic as it's a simple change, BUT it is a functionally different change
> >> from what the current api that this code is replacing is doing (i.e. the
> >> current platform device creation code does this today and no one has
> >> ever hit this in their use of it in the past few decades.)
> >
> > How about something as simple as this change, does that provide what you
> > are thinking about here? Only compile tested, not runtime tested at
> > all:
>
> Yes, LGTM. However dev->driver is set to NULL if the probe fails so
> wouldn't
>
> if (!dev->driver)
>
> do the job?
True, that would work, and be much simpler, I'll go add that AND
actually test it :)
> I understand your point about groups. This of course solves it, although
> isn't there a small windows between device_add() and device_destroy() in
> the failed probe path, in which a show/store/visibility method could
> dereference a NULL drvdata?
Ok, I looked it up and it turns out that the groups wouldn't have even
been created if probe() failed (see the call to call_driver_probe() in
really_probe() in drivers/base/dd.c) So all should be good here.
thanks,
greg k-h
Powered by blists - more mailing lists