Skip to content

Commit 358987a

Browse files
Uwe Kleine-Königmartinkpetersen
authored andcommitted
scsi: sgiwd93: 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/92114604fd1274073915e515cae15003ff07aa4a.1701619134.git.u.kleine-koenig@pengutronix.de Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent e26eec9 commit 358987a

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/scsi/sgiwd93.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ static int sgiwd93_probe(struct platform_device *pdev)
291291
return err;
292292
}
293293

294-
static int sgiwd93_remove(struct platform_device *pdev)
294+
static void sgiwd93_remove(struct platform_device *pdev)
295295
{
296296
struct Scsi_Host *host = platform_get_drvdata(pdev);
297297
struct ip22_hostdata *hdata = (struct ip22_hostdata *) host->hostdata;
@@ -302,12 +302,11 @@ static int sgiwd93_remove(struct platform_device *pdev)
302302
dma_free_noncoherent(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma,
303303
DMA_TO_DEVICE);
304304
scsi_host_put(host);
305-
return 0;
306305
}
307306

308307
static struct platform_driver sgiwd93_driver = {
309308
.probe = sgiwd93_probe,
310-
.remove = sgiwd93_remove,
309+
.remove_new = sgiwd93_remove,
311310
.driver = {
312311
.name = "sgiwd93",
313312
}

0 commit comments

Comments
 (0)