diff options
author | Luis Chamberlain <mcgrof@kernel.org> | 2021-09-28 00:02:58 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-10-18 22:41:37 +0200 |
commit | 625a28a7e60c7c026e4d2929c49c8461fad4b0f3 (patch) | |
tree | 0b2658f44892ecdb65b5d9198c13024c6bf8f097 /drivers/block/swim.c | |
parent | swim: add a floppy registration bool which triggers del_gendisk() (diff) | |
download | linux-625a28a7e60c7c026e4d2929c49c8461fad4b0f3.tar.xz linux-625a28a7e60c7c026e4d2929c49c8461fad4b0f3.zip |
swim: 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.
Since we have a caller to do our unwinding for the disk,
and this is already dealt with safely we can re-use our
existing error path goto label which already deals with
the cleanup.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20210927220302.1073499-11-mcgrof@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/swim.c')
-rw-r--r-- | drivers/block/swim.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/swim.c b/drivers/block/swim.c index eed453528f4c..821594cd1315 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c @@ -843,7 +843,9 @@ static int swim_floppy_init(struct swim_priv *swd) swd->unit[drive].disk->events = DISK_EVENT_MEDIA_CHANGE; swd->unit[drive].disk->private_data = &swd->unit[drive]; set_capacity(swd->unit[drive].disk, 2880); - add_disk(swd->unit[drive].disk); + err = add_disk(swd->unit[drive].disk); + if (err) + goto exit_put_disks; swd->unit[drive].registered = true; } |