summaryrefslogtreecommitdiff
path: root/drivers/cdrom
diff options
context:
space:
mode:
authorLuis Chamberlain <mcgrof@kernel.org>2021-09-28 01:02:27 +0300
committerJens Axboe <axboe@kernel.dk>2021-10-18 23:41:37 +0300
commitd6ac27c60fec4dc59473e39abf924e430a9ea320 (patch)
treeb3cee2d6f44761fedc6eabebbf25bef1639073a9 /drivers/cdrom
parent4fac63f8a871bc2e38dce4944c9d964a62bac3e6 (diff)
downloadlinux-d6ac27c60fec4dc59473e39abf924e430a9ea320.tar.xz
cdrom/gdrom: 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/cdrom')
-rw-r--r--drivers/cdrom/gdrom.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 8e1fe75af93f..d50cc1fd34d5 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -805,9 +805,14 @@ static int probe_gdrom(struct platform_device *devptr)
err = -ENOMEM;
goto probe_fail_free_irqs;
}
- add_disk(gd.disk);
+ err = add_disk(gd.disk);
+ if (err)
+ goto probe_fail_add_disk;
+
return 0;
+probe_fail_add_disk:
+ kfree(gd.toc);
probe_fail_free_irqs:
free_irq(HW_EVENT_GDROM_DMA, &gd);
free_irq(HW_EVENT_GDROM_CMD, &gd);