mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 05:11:48 +00:00
block: Fix an error handling in add_partition
Once we have called device_initialize(), we should use put_device() to give up the reference on error, just like what we have done on failure of device_add(). Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
2569063c71
commit
ef49d40b61
@ -384,7 +384,7 @@ static struct block_device *add_partition(struct gendisk *disk, int partno,
|
|||||||
|
|
||||||
err = blk_alloc_devt(bdev, &devt);
|
err = blk_alloc_devt(bdev, &devt);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_bdput;
|
goto out_put;
|
||||||
pdev->devt = devt;
|
pdev->devt = devt;
|
||||||
|
|
||||||
/* delay uevent until 'holders' subdir is created */
|
/* delay uevent until 'holders' subdir is created */
|
||||||
|
Loading…
Reference in New Issue
Block a user