summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/block/rbd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 641f09898e19..b0f6812f8f99 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2564,19 +2564,21 @@ static int rbd_sysfs_init(void)
{
int ret;
- ret = bus_register(&rbd_bus_type);
+ ret = device_register(&rbd_root_dev);
if (ret < 0)
return ret;
- ret = device_register(&rbd_root_dev);
+ ret = bus_register(&rbd_bus_type);
+ if (ret < 0)
+ device_unregister(&rbd_root_dev);
return ret;
}
static void rbd_sysfs_cleanup(void)
{
- device_unregister(&rbd_root_dev);
bus_unregister(&rbd_bus_type);
+ device_unregister(&rbd_root_dev);
}
int __init rbd_init(void)