summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Chamberlain <mcgrof@kernel.org>2021-10-15 16:52:17 -0700
committerJens Axboe <axboe@kernel.dk>2021-10-30 11:03:37 -0600
commit3c30883acab1d20ecbd3c48dc12b147b51548742 (patch)
tree3e351dfff22c5045c6c10caee5853f8d0eddfd5f
parentff4cbe0fcf5d749f76040f782f0618656cd23e33 (diff)
ps3vram: 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> Acked-by: Geoff Levand <geoff@infradead.org> Link: https://lore.kernel.org/r/20211015235219.2191207-12-mcgrof@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/block/ps3vram.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index d1ebf193cb9a..c1876646a4cb 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -753,9 +753,14 @@ static int ps3vram_probe(struct ps3_system_bus_device *dev)
dev_info(&dev->core, "%s: Using %llu MiB of GPU memory\n",
gendisk->disk_name, get_capacity(gendisk) >> 11);
- device_add_disk(&dev->core, gendisk, NULL);
+ error = device_add_disk(&dev->core, gendisk, NULL);
+ if (error)
+ goto out_cleanup_disk;
+
return 0;
+out_cleanup_disk:
+ blk_cleanup_disk(gendisk);
out_cache_cleanup:
remove_proc_entry(DEVICE_NAME, NULL);
ps3vram_cache_cleanup(dev);