Skip to content

Commit

Permalink
block: remove the extra gendisk reference in __blk_mq_register_dev
Browse files Browse the repository at this point in the history
kobject_add already grabs a reference to the parent, no need to have
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-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Christoph Hellwig authored and axboe committed Jun 28, 2022
1 parent 4a8d14b commit 81f0c2e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions block/blk-mq-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ void blk_mq_unregister_dev(struct device *dev, struct request_queue *q)

kobject_uevent(q->mq_kobj, KOBJ_REMOVE);
kobject_del(q->mq_kobj);
kobject_put(&dev->kobj);

q->mq_sysfs_init_done = false;
}
Expand Down Expand Up @@ -261,7 +260,7 @@ int __blk_mq_register_dev(struct device *dev, struct request_queue *q)
WARN_ON_ONCE(!q->kobj.parent);
lockdep_assert_held(&q->sysfs_dir_lock);

ret = kobject_add(q->mq_kobj, kobject_get(&dev->kobj), "%s", "mq");
ret = kobject_add(q->mq_kobj, &dev->kobj, "%s", "mq");
if (ret < 0)
goto out;

Expand All @@ -286,7 +285,6 @@ int __blk_mq_register_dev(struct device *dev, struct request_queue *q)

kobject_uevent(q->mq_kobj, KOBJ_REMOVE);
kobject_del(q->mq_kobj);
kobject_put(&dev->kobj);
return ret;
}

Expand Down

0 comments on commit 81f0c2e

Please sign in to comment.