block: use put_device in put_disk
authorChristoph Hellwig <hch@lst.de>
Tue, 10 Nov 2020 06:25:37 +0000 (07:25 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 1 Dec 2020 21:53:39 +0000 (14:53 -0700)
Use put_device to put the device instead of poking into the internals
and using kobject_put.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/genhd.c

index 0bd9c41..f46e892 100644 (file)
@@ -1803,7 +1803,7 @@ EXPORT_SYMBOL(__alloc_disk_node);
 void put_disk(struct gendisk *disk)
 {
        if (disk)
-               kobject_put(&disk_to_dev(disk)->kobj);
+               put_device(disk_to_dev(disk));
 }
 EXPORT_SYMBOL(put_disk);