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>
This commit is contained in:
Luis Chamberlain 2021-09-27 15:02:27 -07:00 committed by Jens Axboe
parent 4fac63f8a8
commit d6ac27c60f
1 changed files with 6 additions and 1 deletions

View File

@ -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);