Skip to content

Commit 0dc31b9

Browse files
Uwe Kleine-Königaxboe
authored andcommitted
cdrom: gdrom: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 0f7223a commit 0dc31b9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/cdrom/gdrom.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ static int probe_gdrom(struct platform_device *devptr)
831831
return err;
832832
}
833833

834-
static int remove_gdrom(struct platform_device *devptr)
834+
static void remove_gdrom(struct platform_device *devptr)
835835
{
836836
blk_mq_free_tag_set(&gd.tag_set);
837837
free_irq(HW_EVENT_GDROM_CMD, &gd);
@@ -842,13 +842,11 @@ static int remove_gdrom(struct platform_device *devptr)
842842
unregister_cdrom(gd.cd_info);
843843
kfree(gd.cd_info);
844844
kfree(gd.toc);
845-
846-
return 0;
847845
}
848846

849847
static struct platform_driver gdrom_driver = {
850848
.probe = probe_gdrom,
851-
.remove = remove_gdrom,
849+
.remove_new = remove_gdrom,
852850
.driver = {
853851
.name = GDROM_DEV_NAME,
854852
},

0 commit comments

Comments
 (0)