]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
block/swim3: add error handling support for add_disk()
authorLuis Chamberlain <mcgrof@kernel.org>
Mon, 27 Sep 2021 22:02:49 +0000 (15:02 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Oct 2021 20:41:37 +0000 (14:41 -0600)
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>
drivers/block/swim3.c

index 965af0a3e95b11d17afeaa7ecce71c4d944505e5..f7e3482e846b9ecb30ab83bd6525dbbba0e172a3 100644 (file)
@@ -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;