Skip to content

Commit 5854cdd

Browse files
Uwe Kleine-Königmartinkpetersen
authored andcommitted
scsi: a3000: 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(). In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/811d180950b76c2d95cd080e3c251757ca011380.1701619134.git.u.kleine-koenig@pengutronix.de Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent b85ea95 commit 5854cdd

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/scsi/a3000.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static int __init amiga_a3000_scsi_probe(struct platform_device *pdev)
282282
return error;
283283
}
284284

285-
static int __exit amiga_a3000_scsi_remove(struct platform_device *pdev)
285+
static void __exit amiga_a3000_scsi_remove(struct platform_device *pdev)
286286
{
287287
struct Scsi_Host *instance = platform_get_drvdata(pdev);
288288
struct a3000_hostdata *hdata = shost_priv(instance);
@@ -293,11 +293,10 @@ static int __exit amiga_a3000_scsi_remove(struct platform_device *pdev)
293293
free_irq(IRQ_AMIGA_PORTS, instance);
294294
scsi_host_put(instance);
295295
release_mem_region(res->start, resource_size(res));
296-
return 0;
297296
}
298297

299298
static struct platform_driver amiga_a3000_scsi_driver = {
300-
.remove = __exit_p(amiga_a3000_scsi_remove),
299+
.remove_new = __exit_p(amiga_a3000_scsi_remove),
301300
.driver = {
302301
.name = "amiga-a3000-scsi",
303302
},

0 commit comments

Comments
 (0)