Skip to content

Commit d9f139d

Browse files
Uwe Kleine-Königbebarino
authored andcommitted
clk: mvebu: 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-22-u.kleine-koenig@pengutronix.de Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 65ef13f commit d9f139d

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

drivers/clk/mvebu/armada-37xx-periph.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ static int armada_3700_periph_clock_probe(struct platform_device *pdev)
781781
return 0;
782782
}
783783

784-
static int armada_3700_periph_clock_remove(struct platform_device *pdev)
784+
static void armada_3700_periph_clock_remove(struct platform_device *pdev)
785785
{
786786
struct clk_periph_driver_data *data = platform_get_drvdata(pdev);
787787
struct clk_hw_onecell_data *hw_data = data->hw_data;
@@ -791,13 +791,11 @@ static int armada_3700_periph_clock_remove(struct platform_device *pdev)
791791

792792
for (i = 0; i < hw_data->num; i++)
793793
clk_hw_unregister(hw_data->hws[i]);
794-
795-
return 0;
796794
}
797795

798796
static struct platform_driver armada_3700_periph_clock_driver = {
799797
.probe = armada_3700_periph_clock_probe,
800-
.remove = armada_3700_periph_clock_remove,
798+
.remove_new = armada_3700_periph_clock_remove,
801799
.driver = {
802800
.name = "marvell-armada-3700-periph-clock",
803801
.of_match_table = armada_3700_periph_clock_of_match,

drivers/clk/mvebu/armada-37xx-tbg.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,14 @@ static int armada_3700_tbg_clock_probe(struct platform_device *pdev)
126126
return of_clk_add_hw_provider(np, of_clk_hw_onecell_get, hw_tbg_data);
127127
}
128128

129-
static int armada_3700_tbg_clock_remove(struct platform_device *pdev)
129+
static void armada_3700_tbg_clock_remove(struct platform_device *pdev)
130130
{
131131
int i;
132132
struct clk_hw_onecell_data *hw_tbg_data = platform_get_drvdata(pdev);
133133

134134
of_clk_del_provider(pdev->dev.of_node);
135135
for (i = 0; i < hw_tbg_data->num; i++)
136136
clk_hw_unregister_fixed_factor(hw_tbg_data->hws[i]);
137-
138-
return 0;
139137
}
140138

141139
static const struct of_device_id armada_3700_tbg_clock_of_match[] = {
@@ -145,7 +143,7 @@ static const struct of_device_id armada_3700_tbg_clock_of_match[] = {
145143

146144
static struct platform_driver armada_3700_tbg_clock_driver = {
147145
.probe = armada_3700_tbg_clock_probe,
148-
.remove = armada_3700_tbg_clock_remove,
146+
.remove_new = armada_3700_tbg_clock_remove,
149147
.driver = {
150148
.name = "marvell-armada-3700-tbg-clock",
151149
.of_match_table = armada_3700_tbg_clock_of_match,

drivers/clk/mvebu/armada-37xx-xtal.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,9 @@ static int armada_3700_xtal_clock_probe(struct platform_device *pdev)
6565
return ret;
6666
}
6767

68-
static int armada_3700_xtal_clock_remove(struct platform_device *pdev)
68+
static void armada_3700_xtal_clock_remove(struct platform_device *pdev)
6969
{
7070
of_clk_del_provider(pdev->dev.of_node);
71-
72-
return 0;
7371
}
7472

7573
static const struct of_device_id armada_3700_xtal_clock_of_match[] = {
@@ -79,7 +77,7 @@ static const struct of_device_id armada_3700_xtal_clock_of_match[] = {
7977

8078
static struct platform_driver armada_3700_xtal_clock_driver = {
8179
.probe = armada_3700_xtal_clock_probe,
82-
.remove = armada_3700_xtal_clock_remove,
80+
.remove_new = armada_3700_xtal_clock_remove,
8381
.driver = {
8482
.name = "marvell-armada-3700-xtal-clock",
8583
.of_match_table = armada_3700_xtal_clock_of_match,

0 commit comments

Comments
 (0)