Skip to content

Commit c04ca6b

Browse files
Uwe Kleine-Königmartinezjavier
authored andcommitted
drm/mediatek: 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 the mediatek drm drivers from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <[email protected]> Reviewed-by: Matthias Brugger <[email protected]> Signed-off-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 232b537 commit c04ca6b

14 files changed

+28
-54
lines changed

drivers/gpu/drm/mediatek/mtk_disp_aal.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,9 @@ static int mtk_disp_aal_probe(struct platform_device *pdev)
139139
return ret;
140140
}
141141

142-
static int mtk_disp_aal_remove(struct platform_device *pdev)
142+
static void mtk_disp_aal_remove(struct platform_device *pdev)
143143
{
144144
component_del(&pdev->dev, &mtk_disp_aal_component_ops);
145-
146-
return 0;
147145
}
148146

149147
static const struct mtk_disp_aal_data mt8173_aal_driver_data = {
@@ -160,7 +158,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_aal_driver_dt_match);
160158

161159
struct platform_driver mtk_disp_aal_driver = {
162160
.probe = mtk_disp_aal_probe,
163-
.remove = mtk_disp_aal_remove,
161+
.remove_new = mtk_disp_aal_remove,
164162
.driver = {
165163
.name = "mediatek-disp-aal",
166164
.owner = THIS_MODULE,

drivers/gpu/drm/mediatek/mtk_disp_ccorr.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,9 @@ static int mtk_disp_ccorr_probe(struct platform_device *pdev)
194194
return ret;
195195
}
196196

197-
static int mtk_disp_ccorr_remove(struct platform_device *pdev)
197+
static void mtk_disp_ccorr_remove(struct platform_device *pdev)
198198
{
199199
component_del(&pdev->dev, &mtk_disp_ccorr_component_ops);
200-
201-
return 0;
202200
}
203201

204202
static const struct mtk_disp_ccorr_data mt8183_ccorr_driver_data = {
@@ -220,7 +218,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_ccorr_driver_dt_match);
220218

221219
struct platform_driver mtk_disp_ccorr_driver = {
222220
.probe = mtk_disp_ccorr_probe,
223-
.remove = mtk_disp_ccorr_remove,
221+
.remove_new = mtk_disp_ccorr_remove,
224222
.driver = {
225223
.name = "mediatek-disp-ccorr",
226224
.owner = THIS_MODULE,

drivers/gpu/drm/mediatek/mtk_disp_color.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,9 @@ static int mtk_disp_color_probe(struct platform_device *pdev)
131131
return ret;
132132
}
133133

134-
static int mtk_disp_color_remove(struct platform_device *pdev)
134+
static void mtk_disp_color_remove(struct platform_device *pdev)
135135
{
136136
component_del(&pdev->dev, &mtk_disp_color_component_ops);
137-
138-
return 0;
139137
}
140138

141139
static const struct mtk_disp_color_data mt2701_color_driver_data = {
@@ -163,7 +161,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_color_driver_dt_match);
163161

164162
struct platform_driver mtk_disp_color_driver = {
165163
.probe = mtk_disp_color_probe,
166-
.remove = mtk_disp_color_remove,
164+
.remove_new = mtk_disp_color_remove,
167165
.driver = {
168166
.name = "mediatek-disp-color",
169167
.owner = THIS_MODULE,

drivers/gpu/drm/mediatek/mtk_disp_gamma.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,9 @@ static int mtk_disp_gamma_probe(struct platform_device *pdev)
182182
return ret;
183183
}
184184

185-
static int mtk_disp_gamma_remove(struct platform_device *pdev)
185+
static void mtk_disp_gamma_remove(struct platform_device *pdev)
186186
{
187187
component_del(&pdev->dev, &mtk_disp_gamma_component_ops);
188-
189-
return 0;
190188
}
191189

192190
static const struct mtk_disp_gamma_data mt8173_gamma_driver_data = {
@@ -208,7 +206,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_gamma_driver_dt_match);
208206

209207
struct platform_driver mtk_disp_gamma_driver = {
210208
.probe = mtk_disp_gamma_probe,
211-
.remove = mtk_disp_gamma_remove,
209+
.remove_new = mtk_disp_gamma_remove,
212210
.driver = {
213211
.name = "mediatek-disp-gamma",
214212
.owner = THIS_MODULE,

drivers/gpu/drm/mediatek/mtk_disp_merge.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,9 @@ static int mtk_disp_merge_probe(struct platform_device *pdev)
294294
return ret;
295295
}
296296

297-
static int mtk_disp_merge_remove(struct platform_device *pdev)
297+
static void mtk_disp_merge_remove(struct platform_device *pdev)
298298
{
299299
component_del(&pdev->dev, &mtk_disp_merge_component_ops);
300-
301-
return 0;
302300
}
303301

304302
static const struct of_device_id mtk_disp_merge_driver_dt_match[] = {
@@ -310,7 +308,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_merge_driver_dt_match);
310308

311309
struct platform_driver mtk_disp_merge_driver = {
312310
.probe = mtk_disp_merge_probe,
313-
.remove = mtk_disp_merge_remove,
311+
.remove_new = mtk_disp_merge_remove,
314312
.driver = {
315313
.name = "mediatek-disp-merge",
316314
.owner = THIS_MODULE,

drivers/gpu/drm/mediatek/mtk_disp_ovl.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,12 +561,10 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
561561
return ret;
562562
}
563563

564-
static int mtk_disp_ovl_remove(struct platform_device *pdev)
564+
static void mtk_disp_ovl_remove(struct platform_device *pdev)
565565
{
566566
component_del(&pdev->dev, &mtk_disp_ovl_component_ops);
567567
pm_runtime_disable(&pdev->dev);
568-
569-
return 0;
570568
}
571569

572570
static const struct mtk_disp_ovl_data mt2701_ovl_driver_data = {
@@ -658,7 +656,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_ovl_driver_dt_match);
658656

659657
struct platform_driver mtk_disp_ovl_driver = {
660658
.probe = mtk_disp_ovl_probe,
661-
.remove = mtk_disp_ovl_remove,
659+
.remove_new = mtk_disp_ovl_remove,
662660
.driver = {
663661
.name = "mediatek-disp-ovl",
664662
.owner = THIS_MODULE,

drivers/gpu/drm/mediatek/mtk_disp_rdma.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,11 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
379379
return ret;
380380
}
381381

382-
static int mtk_disp_rdma_remove(struct platform_device *pdev)
382+
static void mtk_disp_rdma_remove(struct platform_device *pdev)
383383
{
384384
component_del(&pdev->dev, &mtk_disp_rdma_component_ops);
385385

386386
pm_runtime_disable(&pdev->dev);
387-
388-
return 0;
389387
}
390388

391389
static const struct mtk_disp_rdma_data mt2701_rdma_driver_data = {
@@ -427,7 +425,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_rdma_driver_dt_match);
427425

428426
struct platform_driver mtk_disp_rdma_driver = {
429427
.probe = mtk_disp_rdma_probe,
430-
.remove = mtk_disp_rdma_remove,
428+
.remove_new = mtk_disp_rdma_remove,
431429
.driver = {
432430
.name = "mediatek-disp-rdma",
433431
.owner = THIS_MODULE,

drivers/gpu/drm/mediatek/mtk_dp.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,7 +2574,7 @@ static int mtk_dp_probe(struct platform_device *pdev)
25742574
return 0;
25752575
}
25762576

2577-
static int mtk_dp_remove(struct platform_device *pdev)
2577+
static void mtk_dp_remove(struct platform_device *pdev)
25782578
{
25792579
struct mtk_dp *mtk_dp = platform_get_drvdata(pdev);
25802580

@@ -2585,8 +2585,6 @@ static int mtk_dp_remove(struct platform_device *pdev)
25852585
platform_device_unregister(mtk_dp->phy_dev);
25862586
if (mtk_dp->audio_pdev)
25872587
platform_device_unregister(mtk_dp->audio_pdev);
2588-
2589-
return 0;
25902588
}
25912589

25922590
#ifdef CONFIG_PM_SLEEP
@@ -2645,7 +2643,7 @@ MODULE_DEVICE_TABLE(of, mtk_dp_of_match);
26452643

26462644
static struct platform_driver mtk_dp_driver = {
26472645
.probe = mtk_dp_probe,
2648-
.remove = mtk_dp_remove,
2646+
.remove_new = mtk_dp_remove,
26492647
.driver = {
26502648
.name = "mediatek-drm-dp",
26512649
.of_match_table = mtk_dp_of_match,

drivers/gpu/drm/mediatek/mtk_dpi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,14 +1101,12 @@ static int mtk_dpi_probe(struct platform_device *pdev)
11011101
return 0;
11021102
}
11031103

1104-
static int mtk_dpi_remove(struct platform_device *pdev)
1104+
static void mtk_dpi_remove(struct platform_device *pdev)
11051105
{
11061106
struct mtk_dpi *dpi = platform_get_drvdata(pdev);
11071107

11081108
component_del(&pdev->dev, &mtk_dpi_component_ops);
11091109
drm_bridge_remove(&dpi->bridge);
1110-
1111-
return 0;
11121110
}
11131111

11141112
static const struct of_device_id mtk_dpi_of_ids[] = {
@@ -1139,7 +1137,7 @@ MODULE_DEVICE_TABLE(of, mtk_dpi_of_ids);
11391137

11401138
struct platform_driver mtk_dpi_driver = {
11411139
.probe = mtk_dpi_probe,
1142-
.remove = mtk_dpi_remove,
1140+
.remove_new = mtk_dpi_remove,
11431141
.driver = {
11441142
.name = "mediatek-dpi",
11451143
.of_match_table = mtk_dpi_of_ids,

drivers/gpu/drm/mediatek/mtk_drm_drv.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ static int mtk_drm_probe(struct platform_device *pdev)
907907
return ret;
908908
}
909909

910-
static int mtk_drm_remove(struct platform_device *pdev)
910+
static void mtk_drm_remove(struct platform_device *pdev)
911911
{
912912
struct mtk_drm_private *private = platform_get_drvdata(pdev);
913913
int i;
@@ -917,8 +917,6 @@ static int mtk_drm_remove(struct platform_device *pdev)
917917
of_node_put(private->mutex_node);
918918
for (i = 0; i < DDP_COMPONENT_DRM_ID_MAX; i++)
919919
of_node_put(private->comp_node[i]);
920-
921-
return 0;
922920
}
923921

924922
static int mtk_drm_sys_prepare(struct device *dev)
@@ -951,7 +949,7 @@ static const struct dev_pm_ops mtk_drm_pm_ops = {
951949

952950
static struct platform_driver mtk_drm_platform_driver = {
953951
.probe = mtk_drm_probe,
954-
.remove = mtk_drm_remove,
952+
.remove_new = mtk_drm_remove,
955953
.driver = {
956954
.name = "mediatek-drm",
957955
.pm = &mtk_drm_pm_ops,

0 commit comments

Comments
 (0)