diff mbox series

[73/78] block: use put_device in put_disk

Message ID 20201116145809.410558-74-hch@lst.de
State New
Headers show
Series [01/78] block: remove the call to __invalidate_device in check_disk_size_change | expand

Commit Message

Christoph Hellwig Nov. 16, 2020, 2:58 p.m. UTC
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>
---
 block/genhd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hannes Reinecke Nov. 20, 2020, 8:02 a.m. UTC | #1
On 11/16/20 3:58 PM, Christoph Hellwig wrote:
> 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>

> ---

>   block/genhd.c | 2 +-

>   1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/block/genhd.c b/block/genhd.c

> index 56bc37e98ed852..f1e20ec1b62887 100644

> --- a/block/genhd.c

> +++ b/block/genhd.c

> @@ -1659,7 +1659,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);

>   

> 

Reviewed-by: Hannes Reinecke <hare@suse.de>


Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
diff mbox series

Patch

diff --git a/block/genhd.c b/block/genhd.c
index 56bc37e98ed852..f1e20ec1b62887 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1659,7 +1659,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);