mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
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>
This commit is contained in:
parent
6a5c083de2
commit
d79d32440c
1 changed files with 2 additions and 2 deletions
|
@ -488,12 +488,12 @@ int __init_or_module platform_driver_probe(struct platform_driver *drv,
|
||||||
* if the probe was successful, and make sure any forced probes of
|
* if the probe was successful, and make sure any forced probes of
|
||||||
* new devices fail.
|
* new devices fail.
|
||||||
*/
|
*/
|
||||||
spin_lock(&platform_bus_type.p->klist_drivers.k_lock);
|
spin_lock(&drv->driver.bus->p->klist_drivers.k_lock);
|
||||||
drv->probe = NULL;
|
drv->probe = NULL;
|
||||||
if (code == 0 && list_empty(&drv->driver.p->klist_devices.k_list))
|
if (code == 0 && list_empty(&drv->driver.p->klist_devices.k_list))
|
||||||
retval = -ENODEV;
|
retval = -ENODEV;
|
||||||
drv->driver.probe = platform_drv_probe_fail;
|
drv->driver.probe = platform_drv_probe_fail;
|
||||||
spin_unlock(&platform_bus_type.p->klist_drivers.k_lock);
|
spin_unlock(&drv->driver.bus->p->klist_drivers.k_lock);
|
||||||
|
|
||||||
if (code != retval)
|
if (code != retval)
|
||||||
platform_driver_unregister(drv);
|
platform_driver_unregister(drv);
|
||||||
|
|
Loading…
Reference in a new issue