Re: [PATCH 2/3] block: untangle request_queue refcounting from sysfs

Eric Biggers
2022-11-07T19:57:41Z

On Sat, Nov 05, 2022 at 09:08:14AM +0100, Christoph Hellwig wrote:
> @@ -811,7 +772,8 @@ int blk_register_queue(struct gendisk *disk)
>
> mutex_lock(&q->sysfs_dir_lock);
>
> - ret = kobject_add(&q->kobj, &disk_to_dev(disk)->kobj, "queue");
> + kobject_init(&disk->queue_kobj, &blk_queue_ktype);
> + ret = kobject_add(&disk->queue_kobj, &disk_to_dev(disk)->kobj, "queue");

Use kobject_init_and_add()? Also, kobject_put() needs to be called on error.

- Eric