block/ataflop: 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-15-mcgrof@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Luis Chamberlain 2021-09-27 15:03:02 -07:00 committed by Jens Axboe
parent deae1138d0
commit 2f15107089

View file

@ -2082,7 +2082,9 @@ static int __init atari_floppy_init (void)
for (i = 0; i < FD_MAX_UNITS; i++) {
unit[i].track = -1;
unit[i].flags = 0;
add_disk(unit[i].disk[0]);
ret = add_disk(unit[i].disk[0]);
if (ret)
goto err_out_dma;
unit[i].registered[0] = true;
}
@ -2093,6 +2095,8 @@ static int __init atari_floppy_init (void)
return 0;
err_out_dma:
atari_stram_free(DMABuffer);
err:
while (--i >= 0)
atari_cleanup_floppy_disk(&unit[i]);