diff options
author | Luis Chamberlain <mcgrof@kernel.org> | 2021-09-27 15:02:53 -0700 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-10-18 14:41:37 -0600 |
commit | 47d34aa2d211e9cef61dd85b7b0011c9f61dd0ae (patch) | |
tree | 23566081fca8d5fdf1886e531e1e90d3d2cac8ad /drivers/block/floppy.c | |
parent | 662167e59d2f3c15a44a88088fc6c1a67c8a3650 (diff) | |
download | linux-stable-47d34aa2d211e9cef61dd85b7b0011c9f61dd0ae.tar.gz linux-stable-47d34aa2d211e9cef61dd85b7b0011c9f61dd0ae.tar.bz2 linux-stable-47d34aa2d211e9cef61dd85b7b0011c9f61dd0ae.zip |
floppy: add error handling support for add_disk()
We never checked for errors on add_disk() as this function
returned void. Now that this is fixed, use the shiny new
error handling.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20210927220302.1073499-6-mcgrof@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r-- | drivers/block/floppy.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index acde3cb63ef4..3873e789478e 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4697,8 +4697,10 @@ static int __init do_floppy_init(void) registered[drive] = true; - device_add_disk(&floppy_device[drive].dev, disks[drive][0], - NULL); + err = device_add_disk(&floppy_device[drive].dev, + disks[drive][0], NULL); + if (err) + goto out_remove_drives; } return 0; |