Skip to content

Commit

Permalink
cdrom/gdrom: add error handling support for add_disk()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
mcgrof authored and axboe committed Oct 18, 2021
1 parent 4fac63f commit d6ac27c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/cdrom/gdrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d6ac27c

Please sign in to comment.