block, blk-sysfs: Fix an err return path in blk_register_queue()
authorLiu Yuan <tailai.ly@taobao.com>
Tue, 19 Apr 2011 11:47:58 +0000 (13:47 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Tue, 19 Apr 2011 11:51:53 +0000 (13:51 +0200)
We do not call blk_trace_remove_sysfs() in err return path
if kobject_add() fails. This path fixes it.

Cc: stable@kernel.org
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
block/blk-sysfs.c

index 6d735122bc59499693d8682d4730c92ff63c91be..5d696adbc4dcdaa94a45943f92d34aba441ff173 100644 (file)
@@ -508,8 +508,10 @@ int blk_register_queue(struct gendisk *disk)
                return ret;
 
        ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue");
-       if (ret < 0)
+       if (ret < 0) {
+               blk_trace_remove_sysfs(dev);
                return ret;
+       }
 
        kobject_uevent(&q->kobj, KOBJ_ADD);