aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/visorbus/visorbus_main.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2015-10-06 17:10:28 +0200
committerIngo Molnar <mingo@kernel.org>2015-10-06 17:10:28 +0200
commit82fc167c392a1700f9adbde639730ee8c8122474 (patch)
tree373ab737a040dd21e5f98425e7c82a6cc4a83568 /drivers/staging/unisys/visorbus/visorbus_main.c
parentatomic: Implement atomic_read_ctrl() (diff)
parentLinux 4.3-rc4 (diff)
downloadlinux-dev-82fc167c392a1700f9adbde639730ee8c8122474.tar.xz
linux-dev-82fc167c392a1700f9adbde639730ee8c8122474.zip
Merge tag 'v4.3-rc4' into locking/core, to pick up fixes before applying new changes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to '')
-rw-r--r--drivers/staging/unisys/visorbus/visorbus_main.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c b/drivers/staging/unisys/visorbus/visorbus_main.c
index 2309f5f2b238..a272b48bab28 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -37,6 +37,8 @@ static int visorbus_debugref;
#define POLLJIFFIES_TESTWORK 100
#define POLLJIFFIES_NORMALCHANNEL 10
+static int busreg_rc = -ENODEV; /* stores the result from bus registration */
+
static int visorbus_uevent(struct device *xdev, struct kobj_uevent_env *env);
static int visorbus_match(struct device *xdev, struct device_driver *xdrv);
static void fix_vbus_dev_info(struct visor_device *visordev);
@@ -863,6 +865,9 @@ int visorbus_register_visor_driver(struct visor_driver *drv)
{
int rc = 0;
+ if (busreg_rc < 0)
+ return -ENODEV; /*can't register on a nonexistent bus*/
+
drv->driver.name = drv->name;
drv->driver.bus = &visorbus_type;
drv->driver.probe = visordriver_probe_device;
@@ -885,6 +890,8 @@ int visorbus_register_visor_driver(struct visor_driver *drv)
if (rc < 0)
return rc;
rc = register_driver_attributes(drv);
+ if (rc < 0)
+ driver_unregister(&drv->driver);
return rc;
}
EXPORT_SYMBOL_GPL(visorbus_register_visor_driver);
@@ -1260,10 +1267,8 @@ remove_bus_instance(struct visor_device *dev)
static int
create_bus_type(void)
{
- int rc = 0;
-
- rc = bus_register(&visorbus_type);
- return rc;
+ busreg_rc = bus_register(&visorbus_type);
+ return busreg_rc;
}
/** Remove the one-and-only one instance of the visor bus type (visorbus_type).