Skip to content

Commit d79d324

Browse files
Patrick Pannutogregkh
authored andcommitted
driver core: platform: Use drv->driver.bus instead of assuming platform_bus_type
In theory (although not *yet* in practice), a driver being passed to platform_driver_probe might have driver.bus set to something other than platform_bus_type. Locking drv->driver.bus is always correct. Signed-off-by: Patrick Pannuto <ppannuto@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 6a5c083 commit d79d324

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/base/platform.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,12 +488,12 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv,
488488
* if the probe was successful, and make sure any forced probes of
489489
* new devices fail.
490490
*/
491-
spin_lock(&platform_bus_type.p->klist_drivers.k_lock);
491+
spin_lock(&drv->driver.bus->p->klist_drivers.k_lock);
492492
drv->probe = NULL;
493493
if (code == 0 && list_empty(&drv->driver.p->klist_devices.k_list))
494494
retval = -ENODEV;
495495
drv->driver.probe = platform_drv_probe_fail;
496-
spin_unlock(&platform_bus_type.p->klist_drivers.k_lock);
496+
spin_unlock(&drv->driver.bus->p->klist_drivers.k_lock);
497497

498498
if (code != retval)
499499
platform_driver_unregister(drv);

0 commit comments

Comments
 (0)