Skip to content

Commit ffc3c92

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
firmware: raspberrypi: 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> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Link: https://lore.kernel.org/r/5df31ef3c069f45634631c9c639bbb60ab1d4798.1703693980.git.u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9eeec41 commit ffc3c92

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/firmware/raspberrypi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ static void rpi_firmware_shutdown(struct platform_device *pdev)
317317
rpi_firmware_property(fw, RPI_FIRMWARE_NOTIFY_REBOOT, NULL, 0);
318318
}
319319

320-
static int rpi_firmware_remove(struct platform_device *pdev)
320+
static void rpi_firmware_remove(struct platform_device *pdev)
321321
{
322322
struct rpi_firmware *fw = platform_get_drvdata(pdev);
323323

@@ -327,8 +327,6 @@ static int rpi_firmware_remove(struct platform_device *pdev)
327327
rpi_clk = NULL;
328328

329329
rpi_firmware_put(fw);
330-
331-
return 0;
332330
}
333331

334332
static const struct of_device_id rpi_firmware_of_match[] = {
@@ -406,7 +404,7 @@ static struct platform_driver rpi_firmware_driver = {
406404
},
407405
.probe = rpi_firmware_probe,
408406
.shutdown = rpi_firmware_shutdown,
409-
.remove = rpi_firmware_remove,
407+
.remove_new = rpi_firmware_remove,
410408
};
411409
module_platform_driver(rpi_firmware_driver);
412410

0 commit comments

Comments
 (0)