Commit 293deb2c authored by David Kershner's avatar David Kershner Committed by Greg Kroah-Hartman

staging: unisys: visorbus: don't unregister if we failed to register

If we fail to register the visordriver, don't call unregister, just
return with the error.
Signed-off-by: default avatarDavid Kershner <david.kershner@unisys.com>
Reviewed-by: default avatarReviewed-by: Tim Sell <timothy.sell@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 711c67f4
...@@ -959,8 +959,6 @@ visordriver_probe_device(struct device *xdev) ...@@ -959,8 +959,6 @@ visordriver_probe_device(struct device *xdev)
*/ */
int visorbus_register_visor_driver(struct visor_driver *drv) int visorbus_register_visor_driver(struct visor_driver *drv)
{ {
int rc = 0;
drv->driver.name = drv->name; drv->driver.name = drv->name;
drv->driver.bus = &visorbus_type; drv->driver.bus = &visorbus_type;
drv->driver.probe = visordriver_probe_device; drv->driver.probe = visordriver_probe_device;
...@@ -980,10 +978,7 @@ int visorbus_register_visor_driver(struct visor_driver *drv) ...@@ -980,10 +978,7 @@ int visorbus_register_visor_driver(struct visor_driver *drv)
* dev.drv = NULL * dev.drv = NULL
*/ */
rc = driver_register(&drv->driver); return driver_register(&drv->driver);
if (rc < 0)
driver_unregister(&drv->driver);
return rc;
} }
EXPORT_SYMBOL_GPL(visorbus_register_visor_driver); EXPORT_SYMBOL_GPL(visorbus_register_visor_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment