summaryrefslogtreecommitdiff
path: root/drivers/block/paride/pcd.c
diff options
context:
space:
mode:
authorLuis Chamberlain <mcgrof@kernel.org>2021-09-28 01:01:07 +0300
committerJens Axboe <axboe@kernel.dk>2021-10-18 23:41:36 +0300
commit4dfbd1390af60765774d9565858d1a6fadacde32 (patch)
treeea396cedd438d4b7cc9d0b1f761c5c5a430efd05 /drivers/block/paride/pcd.c
parent1ad392add59c2a7cc3148b2e3041696370b05e5b (diff)
downloadlinux-4dfbd1390af60765774d9565858d1a6fadacde32.tar.xz
pcd: 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> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/paride/pcd.c')
-rw-r--r--drivers/block/paride/pcd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 93ed63626232..a7fab3830d7b 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -941,9 +941,13 @@ static int pcd_init_unit(struct pcd_unit *cd, bool autoprobe, int port,
cd->present = 1;
pcd_probe_capabilities(cd);
register_cdrom(cd->disk, &cd->info);
- add_disk(cd->disk);
+ ret = add_disk(cd->disk);
+ if (ret)
+ goto out_unreg_cdrom;
return 0;
+out_unreg_cdrom:
+ unregister_cdrom(&cd->info);
out_pi_release:
pi_release(cd->pi);
out_free_disk: