diff options
author | Christoph Hellwig <hch@lst.de> | 2022-06-28 19:18:46 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-06-28 19:32:42 +0200 |
commit | 060f131e9c438837f9792e456fae424e621fb881 (patch) | |
tree | 13f92938541dd0ef044740d7be78ec655bc07f10 /block | |
parent | block: simplify blktrace sysfs attribute creation (diff) | |
download | linux-060f131e9c438837f9792e456fae424e621fb881.tar.xz linux-060f131e9c438837f9792e456fae424e621fb881.zip |
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: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220628171850.1313069-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-sysfs.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 5f3f73115988..f9373da591b8 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -812,14 +812,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; } @@ -883,7 +882,6 @@ put_dev: mutex_unlock(&q->sysfs_lock); mutex_unlock(&q->sysfs_dir_lock); kobject_del(&q->kobj); - kobject_put(&dev->kobj); return ret; } @@ -941,6 +939,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); } |