Skip to content

Commit a65615d

Browse files
Uwe Kleine-Königbebarino
authored andcommitted
clk: mediatek: Convert all remaining drivers to platform_driver's .remove_new()
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 all mediatek clk drivers from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent b3bc727 commit a65615d

16 files changed

+32
-64
lines changed

drivers/clk/mediatek/clk-mt2712-apmixedsys.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,14 @@ static int clk_mt2712_apmixed_probe(struct platform_device *pdev)
138138
return r;
139139
}
140140

141-
static int clk_mt2712_apmixed_remove(struct platform_device *pdev)
141+
static void clk_mt2712_apmixed_remove(struct platform_device *pdev)
142142
{
143143
struct device_node *node = pdev->dev.of_node;
144144
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
145145

146146
of_clk_del_provider(node);
147147
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
148148
mtk_free_clk_data(clk_data);
149-
150-
return 0;
151149
}
152150

153151
static const struct of_device_id of_match_clk_mt2712_apmixed[] = {
@@ -158,7 +156,7 @@ MODULE_DEVICE_TABLE(of, of_match_clk_mt2712_apmixed);
158156

159157
static struct platform_driver clk_mt2712_apmixed_drv = {
160158
.probe = clk_mt2712_apmixed_probe,
161-
.remove = clk_mt2712_apmixed_remove,
159+
.remove_new = clk_mt2712_apmixed_remove,
162160
.driver = {
163161
.name = "clk-mt2712-apmixed",
164162
.of_match_table = of_match_clk_mt2712_apmixed,

drivers/clk/mediatek/clk-mt6795-apmixedsys.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static int clk_mt6795_apmixed_probe(struct platform_device *pdev)
187187
return ret;
188188
}
189189

190-
static int clk_mt6795_apmixed_remove(struct platform_device *pdev)
190+
static void clk_mt6795_apmixed_remove(struct platform_device *pdev)
191191
{
192192
struct device_node *node = pdev->dev.of_node;
193193
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -197,13 +197,11 @@ static int clk_mt6795_apmixed_remove(struct platform_device *pdev)
197197
mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs,
198198
ARRAY_SIZE(pllfhs), clk_data);
199199
mtk_free_clk_data(clk_data);
200-
201-
return 0;
202200
}
203201

204202
static struct platform_driver clk_mt6795_apmixed_drv = {
205203
.probe = clk_mt6795_apmixed_probe,
206-
.remove = clk_mt6795_apmixed_remove,
204+
.remove_new = clk_mt6795_apmixed_remove,
207205
.driver = {
208206
.name = "clk-mt6795-apmixed",
209207
.of_match_table = of_match_clk_mt6795_apmixed,

drivers/clk/mediatek/clk-mt6795-infracfg.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static int clk_mt6795_infracfg_probe(struct platform_device *pdev)
127127
return ret;
128128
}
129129

130-
static int clk_mt6795_infracfg_remove(struct platform_device *pdev)
130+
static void clk_mt6795_infracfg_remove(struct platform_device *pdev)
131131
{
132132
struct device_node *node = pdev->dev.of_node;
133133
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -136,8 +136,6 @@ static int clk_mt6795_infracfg_remove(struct platform_device *pdev)
136136
mtk_clk_unregister_cpumuxes(cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data);
137137
mtk_clk_unregister_gates(infra_gates, ARRAY_SIZE(infra_gates), clk_data);
138138
mtk_free_clk_data(clk_data);
139-
140-
return 0;
141139
}
142140

143141
static struct platform_driver clk_mt6795_infracfg_drv = {
@@ -146,7 +144,7 @@ static struct platform_driver clk_mt6795_infracfg_drv = {
146144
.of_match_table = of_match_clk_mt6795_infracfg,
147145
},
148146
.probe = clk_mt6795_infracfg_probe,
149-
.remove = clk_mt6795_infracfg_remove,
147+
.remove_new = clk_mt6795_infracfg_remove,
150148
};
151149
module_platform_driver(clk_mt6795_infracfg_drv);
152150

drivers/clk/mediatek/clk-mt6795-pericfg.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static int clk_mt6795_pericfg_probe(struct platform_device *pdev)
136136
return ret;
137137
}
138138

139-
static int clk_mt6795_pericfg_remove(struct platform_device *pdev)
139+
static void clk_mt6795_pericfg_remove(struct platform_device *pdev)
140140
{
141141
struct device_node *node = pdev->dev.of_node;
142142
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -145,8 +145,6 @@ static int clk_mt6795_pericfg_remove(struct platform_device *pdev)
145145
mtk_clk_unregister_composites(peri_clks, ARRAY_SIZE(peri_clks), clk_data);
146146
mtk_clk_unregister_gates(peri_gates, ARRAY_SIZE(peri_gates), clk_data);
147147
mtk_free_clk_data(clk_data);
148-
149-
return 0;
150148
}
151149

152150
static struct platform_driver clk_mt6795_pericfg_drv = {
@@ -155,7 +153,7 @@ static struct platform_driver clk_mt6795_pericfg_drv = {
155153
.of_match_table = of_match_clk_mt6795_pericfg,
156154
},
157155
.probe = clk_mt6795_pericfg_probe,
158-
.remove = clk_mt6795_pericfg_remove,
156+
.remove_new = clk_mt6795_pericfg_remove,
159157
};
160158
module_platform_driver(clk_mt6795_pericfg_drv);
161159

drivers/clk/mediatek/clk-mt7622-apmixedsys.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static int clk_mt7622_apmixed_probe(struct platform_device *pdev)
119119
return ret;
120120
}
121121

122-
static int clk_mt7622_apmixed_remove(struct platform_device *pdev)
122+
static void clk_mt7622_apmixed_remove(struct platform_device *pdev)
123123
{
124124
struct device_node *node = pdev->dev.of_node;
125125
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -128,8 +128,6 @@ static int clk_mt7622_apmixed_remove(struct platform_device *pdev)
128128
mtk_clk_unregister_gates(apmixed_clks, ARRAY_SIZE(apmixed_clks), clk_data);
129129
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
130130
mtk_free_clk_data(clk_data);
131-
132-
return 0;
133131
}
134132

135133
static const struct of_device_id of_match_clk_mt7622_apmixed[] = {
@@ -140,7 +138,7 @@ MODULE_DEVICE_TABLE(of, of_match_clk_mt7622_apmixed);
140138

141139
static struct platform_driver clk_mt7622_apmixed_drv = {
142140
.probe = clk_mt7622_apmixed_probe,
143-
.remove = clk_mt7622_apmixed_remove,
141+
.remove_new = clk_mt7622_apmixed_remove,
144142
.driver = {
145143
.name = "clk-mt7622-apmixed",
146144
.of_match_table = of_match_clk_mt7622_apmixed,

drivers/clk/mediatek/clk-mt7622-infracfg.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static int clk_mt7622_infracfg_probe(struct platform_device *pdev)
101101
return ret;
102102
}
103103

104-
static int clk_mt7622_infracfg_remove(struct platform_device *pdev)
104+
static void clk_mt7622_infracfg_remove(struct platform_device *pdev)
105105
{
106106
struct device_node *node = pdev->dev.of_node;
107107
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -110,8 +110,6 @@ static int clk_mt7622_infracfg_remove(struct platform_device *pdev)
110110
mtk_clk_unregister_cpumuxes(cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data);
111111
mtk_clk_unregister_gates(infra_clks, ARRAY_SIZE(infra_clks), clk_data);
112112
mtk_free_clk_data(clk_data);
113-
114-
return 0;
115113
}
116114

117115
static struct platform_driver clk_mt7622_infracfg_drv = {
@@ -120,7 +118,7 @@ static struct platform_driver clk_mt7622_infracfg_drv = {
120118
.of_match_table = of_match_clk_mt7622_infracfg,
121119
},
122120
.probe = clk_mt7622_infracfg_probe,
123-
.remove = clk_mt7622_infracfg_remove,
121+
.remove_new = clk_mt7622_infracfg_remove,
124122
};
125123
module_platform_driver(clk_mt7622_infracfg_drv);
126124

drivers/clk/mediatek/clk-mt8135-apmixedsys.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,14 @@ static int clk_mt8135_apmixed_probe(struct platform_device *pdev)
7373
return ret;
7474
}
7575

76-
static int clk_mt8135_apmixed_remove(struct platform_device *pdev)
76+
static void clk_mt8135_apmixed_remove(struct platform_device *pdev)
7777
{
7878
struct device_node *node = pdev->dev.of_node;
7979
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
8080

8181
of_clk_del_provider(node);
8282
mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data);
8383
mtk_free_clk_data(clk_data);
84-
85-
return 0;
8684
}
8785

8886
static const struct of_device_id of_match_clk_mt8135_apmixed[] = {
@@ -93,7 +91,7 @@ MODULE_DEVICE_TABLE(of, of_match_clk_mt8135_apmixed);
9391

9492
static struct platform_driver clk_mt8135_apmixed_drv = {
9593
.probe = clk_mt8135_apmixed_probe,
96-
.remove = clk_mt8135_apmixed_remove,
94+
.remove_new = clk_mt8135_apmixed_remove,
9795
.driver = {
9896
.name = "clk-mt8135-apmixed",
9997
.of_match_table = of_match_clk_mt8135_apmixed,

drivers/clk/mediatek/clk-mt8173-apmixedsys.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ static int clk_mt8173_apmixed_probe(struct platform_device *pdev)
189189
return r;
190190
}
191191

192-
static int clk_mt8173_apmixed_remove(struct platform_device *pdev)
192+
static void clk_mt8173_apmixed_remove(struct platform_device *pdev)
193193
{
194194
struct device_node *node = pdev->dev.of_node;
195195
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -199,13 +199,11 @@ static int clk_mt8173_apmixed_remove(struct platform_device *pdev)
199199
mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs,
200200
ARRAY_SIZE(pllfhs), clk_data);
201201
mtk_free_clk_data(clk_data);
202-
203-
return 0;
204202
}
205203

206204
static struct platform_driver clk_mt8173_apmixed_drv = {
207205
.probe = clk_mt8173_apmixed_probe,
208-
.remove = clk_mt8173_apmixed_remove,
206+
.remove_new = clk_mt8173_apmixed_remove,
209207
.driver = {
210208
.name = "clk-mt8173-apmixed",
211209
.of_match_table = of_match_clk_mt8173_apmixed,

drivers/clk/mediatek/clk-mt8173-infracfg.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static int clk_mt8173_infracfg_probe(struct platform_device *pdev)
129129
return r;
130130
}
131131

132-
static int clk_mt8173_infracfg_remove(struct platform_device *pdev)
132+
static void clk_mt8173_infracfg_remove(struct platform_device *pdev)
133133
{
134134
struct device_node *node = pdev->dev.of_node;
135135
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -138,8 +138,6 @@ static int clk_mt8173_infracfg_remove(struct platform_device *pdev)
138138
mtk_clk_unregister_cpumuxes(cpu_muxes, ARRAY_SIZE(cpu_muxes), clk_data);
139139
mtk_clk_unregister_gates(infra_gates, ARRAY_SIZE(infra_gates), clk_data);
140140
mtk_free_clk_data(clk_data);
141-
142-
return 0;
143141
}
144142

145143
static struct platform_driver clk_mt8173_infracfg_drv = {
@@ -148,7 +146,7 @@ static struct platform_driver clk_mt8173_infracfg_drv = {
148146
.of_match_table = of_match_clk_mt8173_infracfg,
149147
},
150148
.probe = clk_mt8173_infracfg_probe,
151-
.remove = clk_mt8173_infracfg_remove,
149+
.remove_new = clk_mt8173_infracfg_remove,
152150
};
153151
module_platform_driver(clk_mt8173_infracfg_drv);
154152

drivers/clk/mediatek/clk-mt8186-apmixedsys.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static int clk_mt8186_apmixed_probe(struct platform_device *pdev)
172172
return r;
173173
}
174174

175-
static int clk_mt8186_apmixed_remove(struct platform_device *pdev)
175+
static void clk_mt8186_apmixed_remove(struct platform_device *pdev)
176176
{
177177
struct device_node *node = pdev->dev.of_node;
178178
struct clk_hw_onecell_data *clk_data = platform_get_drvdata(pdev);
@@ -181,13 +181,11 @@ static int clk_mt8186_apmixed_remove(struct platform_device *pdev)
181181
mtk_clk_unregister_pllfhs(plls, ARRAY_SIZE(plls), pllfhs,
182182
ARRAY_SIZE(pllfhs), clk_data);
183183
mtk_free_clk_data(clk_data);
184-
185-
return 0;
186184
}
187185

188186
static struct platform_driver clk_mt8186_apmixed_drv = {
189187
.probe = clk_mt8186_apmixed_probe,
190-
.remove = clk_mt8186_apmixed_remove,
188+
.remove_new = clk_mt8186_apmixed_remove,
191189
.driver = {
192190
.name = "clk-mt8186-apmixed",
193191
.of_match_table = of_match_clk_mt8186_apmixed,

0 commit comments

Comments
 (0)