Skip to content

Commit 51e24ba

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
firmware: stratix10-svc: 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 <u.kleine-koenig@pengutronix.de> Acked-by: Dinh Nguyen <dinguyen@kernel.org> Link: https://lore.kernel.org/r/e574041cdce2e4e69f729dfa726a6d090762cff9.1703693980.git.u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6ac63d0 commit 51e24ba

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/firmware/stratix10-svc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
12511251
return ret;
12521252
}
12531253

1254-
static int stratix10_svc_drv_remove(struct platform_device *pdev)
1254+
static void stratix10_svc_drv_remove(struct platform_device *pdev)
12551255
{
12561256
struct stratix10_svc *svc = dev_get_drvdata(&pdev->dev);
12571257
struct stratix10_svc_controller *ctrl = platform_get_drvdata(pdev);
@@ -1267,13 +1267,11 @@ static int stratix10_svc_drv_remove(struct platform_device *pdev)
12671267
if (ctrl->genpool)
12681268
gen_pool_destroy(ctrl->genpool);
12691269
list_del(&ctrl->node);
1270-
1271-
return 0;
12721270
}
12731271

12741272
static struct platform_driver stratix10_svc_driver = {
12751273
.probe = stratix10_svc_drv_probe,
1276-
.remove = stratix10_svc_drv_remove,
1274+
.remove_new = stratix10_svc_drv_remove,
12771275
.driver = {
12781276
.name = "stratix10-svc",
12791277
.of_match_table = stratix10_svc_drv_match,

0 commit comments

Comments
 (0)