@@ -805,14 +805,13 @@ int blk_register_queue(struct gendisk *disk)
mutex_lock(&q->sysfs_dir_lock);
- ret = kobject_add(&q->kobj, kobject_get(&dev->kobj), "%s", "queue");
+ ret = kobject_add(&q->kobj, &dev->kobj, "%s", "queue");
if (ret < 0)
goto unlock;
ret = sysfs_create_group(&q->kobj, &queue_attr_group);
if (ret) {
kobject_del(&q->kobj);
- kobject_put(&dev->kobj);
goto unlock;
}
@@ -876,7 +875,6 @@ int blk_register_queue(struct gendisk *disk)
mutex_unlock(&q->sysfs_lock);
mutex_unlock(&q->sysfs_dir_lock);
kobject_del(&q->kobj);
- kobject_put(&dev->kobj);
return ret;
}
@@ -934,6 +932,4 @@ void blk_unregister_queue(struct gendisk *disk)
q->sched_debugfs_dir = NULL;
q->rqos_debugfs_dir = NULL;
mutex_unlock(&q->debugfs_mutex);
-
- kobject_put(&disk_to_dev(disk)->kobj);
}
kobject_add already adds a referene to the parent that is dropped on deletion, so don't bother grabbing another one. Signed-off-by: Christoph Hellwig <hch@lst.de> --- block/blk-sysfs.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)