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>
This commit is contained in:
Luis Chamberlain 2021-09-27 15:02:53 -07:00 committed by Jens Axboe
parent 662167e59d
commit 47d34aa2d2

View File

@ -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;