Skip to content

Commit

Permalink
block, blk-sysfs: Fix an err return path in blk_register_queue()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Liu Yuan authored and Jens Axboe committed Apr 19, 2011
1 parent d350e6b commit ed5302d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion block/blk-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit ed5302d

Please sign in to comment.