Commit d79d32440c33cf60f1e0efbeb8144b1647be0b50
Committed by
Greg Kroah-Hartman
1 parent
6a5c083de2
Exists in
master
and in
20 other branches
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>
Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff
drivers/base/platform.c
... | ... | @@ -488,12 +488,12 @@ |
488 | 488 | * if the probe was successful, and make sure any forced probes of |
489 | 489 | * new devices fail. |
490 | 490 | */ |
491 | - spin_lock(&platform_bus_type.p->klist_drivers.k_lock); | |
491 | + spin_lock(&drv->driver.bus->p->klist_drivers.k_lock); | |
492 | 492 | drv->probe = NULL; |
493 | 493 | if (code == 0 && list_empty(&drv->driver.p->klist_devices.k_list)) |
494 | 494 | retval = -ENODEV; |
495 | 495 | 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); | |
497 | 497 | |
498 | 498 | if (code != retval) |
499 | 499 | platform_driver_unregister(drv); |