Skip to content

Commit 04d1918

Browse files
Uwe Kleine-Königbebarino
authored andcommitted
clk: bcm: 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 (mostly) ignored 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. 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/20230312161512.2715500-6-u.kleine-koenig@pengutronix.de Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent b3438f5 commit 04d1918

3 files changed

Lines changed: 6 additions & 12 deletions

File tree

drivers/clk/bcm/clk-bcm2711-dvp.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,13 @@ static int clk_dvp_probe(struct platform_device *pdev)
9292
return ret;
9393
};
9494

95-
static int clk_dvp_remove(struct platform_device *pdev)
95+
static void clk_dvp_remove(struct platform_device *pdev)
9696
{
9797
struct clk_dvp *dvp = platform_get_drvdata(pdev);
9898
struct clk_hw_onecell_data *data = dvp->data;
9999

100100
clk_hw_unregister_gate(data->hws[1]);
101101
clk_hw_unregister_gate(data->hws[0]);
102-
103-
return 0;
104102
}
105103

106104
static const struct of_device_id clk_dvp_dt_ids[] = {
@@ -111,7 +109,7 @@ MODULE_DEVICE_TABLE(of, clk_dvp_dt_ids);
111109

112110
static struct platform_driver clk_dvp_driver = {
113111
.probe = clk_dvp_probe,
114-
.remove = clk_dvp_remove,
112+
.remove_new = clk_dvp_remove,
115113
.driver = {
116114
.name = "brcm2711-dvp",
117115
.of_match_table = clk_dvp_dt_ids,

drivers/clk/bcm/clk-bcm63xx-gate.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ static int clk_bcm63xx_probe(struct platform_device *pdev)
541541
return ret;
542542
}
543543

544-
static int clk_bcm63xx_remove(struct platform_device *pdev)
544+
static void clk_bcm63xx_remove(struct platform_device *pdev)
545545
{
546546
struct clk_bcm63xx_hw *hw = platform_get_drvdata(pdev);
547547
int i;
@@ -552,8 +552,6 @@ static int clk_bcm63xx_remove(struct platform_device *pdev)
552552
if (!IS_ERR(hw->data.hws[i]))
553553
clk_hw_unregister_gate(hw->data.hws[i]);
554554
}
555-
556-
return 0;
557555
}
558556

559557
static const struct of_device_id clk_bcm63xx_dt_ids[] = {
@@ -570,7 +568,7 @@ static const struct of_device_id clk_bcm63xx_dt_ids[] = {
570568

571569
static struct platform_driver clk_bcm63xx = {
572570
.probe = clk_bcm63xx_probe,
573-
.remove = clk_bcm63xx_remove,
571+
.remove_new = clk_bcm63xx_remove,
574572
.driver = {
575573
.name = "bcm63xx-clock",
576574
.of_match_table = clk_bcm63xx_dt_ids,

drivers/clk/bcm/clk-raspberrypi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,13 +439,11 @@ static int raspberrypi_clk_probe(struct platform_device *pdev)
439439
return 0;
440440
}
441441

442-
static int raspberrypi_clk_remove(struct platform_device *pdev)
442+
static void raspberrypi_clk_remove(struct platform_device *pdev)
443443
{
444444
struct raspberrypi_clk *rpi = platform_get_drvdata(pdev);
445445

446446
platform_device_unregister(rpi->cpufreq);
447-
448-
return 0;
449447
}
450448

451449
static const struct of_device_id raspberrypi_clk_match[] = {
@@ -460,7 +458,7 @@ static struct platform_driver raspberrypi_clk_driver = {
460458
.of_match_table = raspberrypi_clk_match,
461459
},
462460
.probe = raspberrypi_clk_probe,
463-
.remove = raspberrypi_clk_remove,
461+
.remove_new = raspberrypi_clk_remove,
464462
};
465463
module_platform_driver(raspberrypi_clk_driver);
466464

0 commit comments

Comments
 (0)