]> git.baikalelectronics.ru Git - kernel.git/commitdiff
block: remove the extra gendisk reference in __blk_mq_register_dev
authorChristoph Hellwig <hch@lst.de>
Tue, 28 Jun 2022 17:18:48 +0000 (19:18 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 28 Jun 2022 17:32:42 +0000 (11:32 -0600)
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>
block/blk-mq-sysfs.c

index c08426975856e94614492354a7adf22f4cccbe38..f4caaa668e3cfd418109e4c774915b36fabb5a47 100644 (file)
@@ -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;
 }
@@ -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;
 
@@ -286,7 +285,6 @@ unreg:
 
        kobject_uevent(q->mq_kobj, KOBJ_REMOVE);
        kobject_del(q->mq_kobj);
-       kobject_put(&dev->kobj);
        return ret;
 }