diff options
author | Luis Chamberlain | 2021-09-27 15:02:49 -0700 |
---|---|---|
committer | Jens Axboe | 2021-10-18 14:41:37 -0600 |
commit | 2d4bcf76429713c2ca0093c11b5b75072db95a50 (patch) | |
tree | 4182f314081eba86b33291eaa6ae6a8c09fcc8ac /drivers | |
parent | 27c97abc30e2b9ad2288977c0ecbef4d50553f57 (diff) |
block/swim3: 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-2-mcgrof@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/swim3.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index 965af0a3e95b..f7e3482e846b 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c @@ -1229,7 +1229,9 @@ static int swim3_attach(struct macio_dev *mdev, disk->flags |= GENHD_FL_REMOVABLE; sprintf(disk->disk_name, "fd%d", floppy_count); set_capacity(disk, 2880); - add_disk(disk); + rc = add_disk(disk); + if (rc) + goto out_cleanup_disk; disks[floppy_count++] = disk; return 0; |