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@xxxxxxxxxx> --- drivers/block/floppy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 3592a6277d0b..0434f28742e7 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4696,8 +4696,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; -- 2.30.2