Commit 060f131e authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: remove a superflous queue kobject reference

kobject_add already adds a reference to the parent that is dropped
on deletion, so don't bother grabbing another one.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220628171850.1313069-3-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent cc5c516d
...@@ -812,14 +812,13 @@ int blk_register_queue(struct gendisk *disk) ...@@ -812,14 +812,13 @@ int blk_register_queue(struct gendisk *disk)
mutex_lock(&q->sysfs_dir_lock); 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) if (ret < 0)
goto unlock; goto unlock;
ret = sysfs_create_group(&q->kobj, &queue_attr_group); ret = sysfs_create_group(&q->kobj, &queue_attr_group);
if (ret) { if (ret) {
kobject_del(&q->kobj); kobject_del(&q->kobj);
kobject_put(&dev->kobj);
goto unlock; goto unlock;
} }
...@@ -883,7 +882,6 @@ int blk_register_queue(struct gendisk *disk) ...@@ -883,7 +882,6 @@ int blk_register_queue(struct gendisk *disk)
mutex_unlock(&q->sysfs_lock); mutex_unlock(&q->sysfs_lock);
mutex_unlock(&q->sysfs_dir_lock); mutex_unlock(&q->sysfs_dir_lock);
kobject_del(&q->kobj); kobject_del(&q->kobj);
kobject_put(&dev->kobj);
return ret; return ret;
} }
...@@ -941,6 +939,4 @@ void blk_unregister_queue(struct gendisk *disk) ...@@ -941,6 +939,4 @@ void blk_unregister_queue(struct gendisk *disk)
q->sched_debugfs_dir = NULL; q->sched_debugfs_dir = NULL;
q->rqos_debugfs_dir = NULL; q->rqos_debugfs_dir = NULL;
mutex_unlock(&q->debugfs_mutex); mutex_unlock(&q->debugfs_mutex);
kobject_put(&disk_to_dev(disk)->kobj);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment