mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 13:51:44 +00:00
driver core: platform: removed unneeded variable from __platform_driver_probe()
In the reworking of the function __platform_driver_probe() over the years, it turns out that the variable 'code' does not actually do anything or mean anything anymore and can be removed to simplify the logic when trying to read and understand what this function is actually doing. Cc: "Rafael J. Wysocki" <rafael@kernel.org> Link: https://lore.kernel.org/r/20230131082459.301603-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a69ea7a76d
commit
b4ce0bf7ab
@ -906,7 +906,7 @@ static int platform_probe_fail(struct platform_device *pdev)
|
|||||||
int __init_or_module __platform_driver_probe(struct platform_driver *drv,
|
int __init_or_module __platform_driver_probe(struct platform_driver *drv,
|
||||||
int (*probe)(struct platform_device *), struct module *module)
|
int (*probe)(struct platform_device *), struct module *module)
|
||||||
{
|
{
|
||||||
int retval, code;
|
int retval;
|
||||||
|
|
||||||
if (drv->driver.probe_type == PROBE_PREFER_ASYNCHRONOUS) {
|
if (drv->driver.probe_type == PROBE_PREFER_ASYNCHRONOUS) {
|
||||||
pr_err("%s: drivers registered with %s can not be probed asynchronously\n",
|
pr_err("%s: drivers registered with %s can not be probed asynchronously\n",
|
||||||
@ -932,7 +932,7 @@ int __init_or_module __platform_driver_probe(struct platform_driver *drv,
|
|||||||
|
|
||||||
/* temporary section violation during probe() */
|
/* temporary section violation during probe() */
|
||||||
drv->probe = probe;
|
drv->probe = probe;
|
||||||
retval = code = __platform_driver_register(drv, module);
|
retval = __platform_driver_register(drv, module);
|
||||||
if (retval)
|
if (retval)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
@ -944,11 +944,11 @@ int __init_or_module __platform_driver_probe(struct platform_driver *drv,
|
|||||||
*/
|
*/
|
||||||
spin_lock(&drv->driver.bus->p->klist_drivers.k_lock);
|
spin_lock(&drv->driver.bus->p->klist_drivers.k_lock);
|
||||||
drv->probe = platform_probe_fail;
|
drv->probe = platform_probe_fail;
|
||||||
if (code == 0 && list_empty(&drv->driver.p->klist_devices.k_list))
|
if (list_empty(&drv->driver.p->klist_devices.k_list))
|
||||||
retval = -ENODEV;
|
retval = -ENODEV;
|
||||||
spin_unlock(&drv->driver.bus->p->klist_drivers.k_lock);
|
spin_unlock(&drv->driver.bus->p->klist_drivers.k_lock);
|
||||||
|
|
||||||
if (code != retval)
|
if (retval)
|
||||||
platform_driver_unregister(drv);
|
platform_driver_unregister(drv);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user