Skip to content

Commit 01790d5

Browse files
Uwe Kleine-Königmartinezjavier
authored andcommitted
drm/msm: 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 msm 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: Dmitry Baryshkov <[email protected]> Signed-off-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent c04ca6b commit 01790d5

File tree

10 files changed

+20
-38
lines changed

10 files changed

+20
-38
lines changed

drivers/gpu/drm/msm/adreno/adreno_device.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,10 +647,9 @@ static int adreno_probe(struct platform_device *pdev)
647647
return 0;
648648
}
649649

650-
static int adreno_remove(struct platform_device *pdev)
650+
static void adreno_remove(struct platform_device *pdev)
651651
{
652652
component_del(&pdev->dev, &a3xx_ops);
653-
return 0;
654653
}
655654

656655
static void adreno_shutdown(struct platform_device *pdev)
@@ -765,7 +764,7 @@ static const struct dev_pm_ops adreno_pm_ops = {
765764

766765
static struct platform_driver adreno_driver = {
767766
.probe = adreno_probe,
768-
.remove = adreno_remove,
767+
.remove_new = adreno_remove,
769768
.shutdown = adreno_shutdown,
770769
.driver = {
771770
.name = "adreno",

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,11 +1239,9 @@ static int dpu_dev_probe(struct platform_device *pdev)
12391239
return msm_drv_probe(&pdev->dev, dpu_kms_init);
12401240
}
12411241

1242-
static int dpu_dev_remove(struct platform_device *pdev)
1242+
static void dpu_dev_remove(struct platform_device *pdev)
12431243
{
12441244
component_master_del(&pdev->dev, &msm_drm_ops);
1245-
1246-
return 0;
12471245
}
12481246

12491247
static int __maybe_unused dpu_runtime_suspend(struct device *dev)
@@ -1318,7 +1316,7 @@ MODULE_DEVICE_TABLE(of, dpu_dt_match);
13181316

13191317
static struct platform_driver dpu_driver = {
13201318
.probe = dpu_dev_probe,
1321-
.remove = dpu_dev_remove,
1319+
.remove_new = dpu_dev_remove,
13221320
.shutdown = msm_drv_shutdown,
13231321
.driver = {
13241322
.name = "msm_dpu",

drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,11 +561,9 @@ static int mdp4_probe(struct platform_device *pdev)
561561
return msm_drv_probe(&pdev->dev, mdp4_kms_init);
562562
}
563563

564-
static int mdp4_remove(struct platform_device *pdev)
564+
static void mdp4_remove(struct platform_device *pdev)
565565
{
566566
component_master_del(&pdev->dev, &msm_drm_ops);
567-
568-
return 0;
569567
}
570568

571569
static const struct of_device_id mdp4_dt_match[] = {
@@ -576,7 +574,7 @@ MODULE_DEVICE_TABLE(of, mdp4_dt_match);
576574

577575
static struct platform_driver mdp4_platform_driver = {
578576
.probe = mdp4_probe,
579-
.remove = mdp4_remove,
577+
.remove_new = mdp4_remove,
580578
.shutdown = msm_drv_shutdown,
581579
.driver = {
582580
.name = "mdp4",

drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -942,11 +942,10 @@ static int mdp5_dev_probe(struct platform_device *pdev)
942942
return msm_drv_probe(&pdev->dev, mdp5_kms_init);
943943
}
944944

945-
static int mdp5_dev_remove(struct platform_device *pdev)
945+
static void mdp5_dev_remove(struct platform_device *pdev)
946946
{
947947
DBG("");
948948
component_master_del(&pdev->dev, &msm_drm_ops);
949-
return 0;
950949
}
951950

952951
static __maybe_unused int mdp5_runtime_suspend(struct device *dev)
@@ -987,7 +986,7 @@ MODULE_DEVICE_TABLE(of, mdp5_dt_match);
987986

988987
static struct platform_driver mdp5_driver = {
989988
.probe = mdp5_dev_probe,
990-
.remove = mdp5_dev_remove,
989+
.remove_new = mdp5_dev_remove,
991990
.shutdown = msm_drv_shutdown,
992991
.driver = {
993992
.name = "msm_mdp",

drivers/gpu/drm/msm/dp/dp_display.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,16 +1296,14 @@ static int dp_display_probe(struct platform_device *pdev)
12961296
return rc;
12971297
}
12981298

1299-
static int dp_display_remove(struct platform_device *pdev)
1299+
static void dp_display_remove(struct platform_device *pdev)
13001300
{
13011301
struct dp_display_private *dp = dev_get_dp_display_private(&pdev->dev);
13021302

13031303
component_del(&pdev->dev, &dp_display_comp_ops);
13041304
dp_display_deinit_sub_modules(dp);
13051305

13061306
platform_set_drvdata(pdev, NULL);
1307-
1308-
return 0;
13091307
}
13101308

13111309
static int dp_pm_resume(struct device *dev)
@@ -1415,7 +1413,7 @@ static const struct dev_pm_ops dp_pm_ops = {
14151413

14161414
static struct platform_driver dp_display_driver = {
14171415
.probe = dp_display_probe,
1418-
.remove = dp_display_remove,
1416+
.remove_new = dp_display_remove,
14191417
.driver = {
14201418
.name = "msm-dp-display",
14211419
.of_match_table = dp_dt_match,

drivers/gpu/drm/msm/dsi/dsi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,12 @@ static int dsi_dev_probe(struct platform_device *pdev)
161161
return 0;
162162
}
163163

164-
static int dsi_dev_remove(struct platform_device *pdev)
164+
static void dsi_dev_remove(struct platform_device *pdev)
165165
{
166166
struct msm_dsi *msm_dsi = platform_get_drvdata(pdev);
167167

168168
DBG("");
169169
dsi_destroy(msm_dsi);
170-
171-
return 0;
172170
}
173171

174172
static const struct of_device_id dt_match[] = {
@@ -187,7 +185,7 @@ static const struct dev_pm_ops dsi_pm_ops = {
187185

188186
static struct platform_driver dsi_driver = {
189187
.probe = dsi_dev_probe,
190-
.remove = dsi_dev_remove,
188+
.remove_new = dsi_dev_remove,
191189
.driver = {
192190
.name = "msm_dsi",
193191
.of_match_table = dt_match,

drivers/gpu/drm/msm/hdmi/hdmi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,15 +551,13 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
551551
return ret;
552552
}
553553

554-
static int msm_hdmi_dev_remove(struct platform_device *pdev)
554+
static void msm_hdmi_dev_remove(struct platform_device *pdev)
555555
{
556556
struct hdmi *hdmi = dev_get_drvdata(&pdev->dev);
557557

558558
component_del(&pdev->dev, &msm_hdmi_ops);
559559

560560
msm_hdmi_put_phy(hdmi);
561-
562-
return 0;
563561
}
564562

565563
static const struct of_device_id msm_hdmi_dt_match[] = {
@@ -574,7 +572,7 @@ static const struct of_device_id msm_hdmi_dt_match[] = {
574572

575573
static struct platform_driver msm_hdmi_driver = {
576574
.probe = msm_hdmi_dev_probe,
577-
.remove = msm_hdmi_dev_remove,
575+
.remove_new = msm_hdmi_dev_remove,
578576
.driver = {
579577
.name = "hdmi_msm",
580578
.of_match_table = msm_hdmi_dt_match,

drivers/gpu/drm/msm/hdmi/hdmi_phy.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,9 @@ static int msm_hdmi_phy_probe(struct platform_device *pdev)
177177
return 0;
178178
}
179179

180-
static int msm_hdmi_phy_remove(struct platform_device *pdev)
180+
static void msm_hdmi_phy_remove(struct platform_device *pdev)
181181
{
182182
pm_runtime_disable(&pdev->dev);
183-
184-
return 0;
185183
}
186184

187185
static const struct of_device_id msm_hdmi_phy_dt_match[] = {
@@ -200,7 +198,7 @@ static const struct of_device_id msm_hdmi_phy_dt_match[] = {
200198

201199
static struct platform_driver msm_hdmi_phy_platform_driver = {
202200
.probe = msm_hdmi_phy_probe,
203-
.remove = msm_hdmi_phy_remove,
201+
.remove_new = msm_hdmi_phy_remove,
204202
.driver = {
205203
.name = "msm_hdmi_phy",
206204
.of_match_table = msm_hdmi_phy_dt_match,

drivers/gpu/drm/msm/msm_drv.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,11 +1278,9 @@ static int msm_pdev_probe(struct platform_device *pdev)
12781278
return msm_drv_probe(&pdev->dev, NULL);
12791279
}
12801280

1281-
static int msm_pdev_remove(struct platform_device *pdev)
1281+
static void msm_pdev_remove(struct platform_device *pdev)
12821282
{
12831283
component_master_del(&pdev->dev, &msm_drm_ops);
1284-
1285-
return 0;
12861284
}
12871285

12881286
void msm_drv_shutdown(struct platform_device *pdev)
@@ -1303,7 +1301,7 @@ void msm_drv_shutdown(struct platform_device *pdev)
13031301

13041302
static struct platform_driver msm_platform_driver = {
13051303
.probe = msm_pdev_probe,
1306-
.remove = msm_pdev_remove,
1304+
.remove_new = msm_pdev_remove,
13071305
.shutdown = msm_drv_shutdown,
13081306
.driver = {
13091307
.name = "msm",

drivers/gpu/drm/msm/msm_mdss.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,15 +492,13 @@ static int mdss_probe(struct platform_device *pdev)
492492
return 0;
493493
}
494494

495-
static int mdss_remove(struct platform_device *pdev)
495+
static void mdss_remove(struct platform_device *pdev)
496496
{
497497
struct msm_mdss *mdss = platform_get_drvdata(pdev);
498498

499499
of_platform_depopulate(&pdev->dev);
500500

501501
msm_mdss_destroy(mdss);
502-
503-
return 0;
504502
}
505503

506504
static const struct msm_mdss_data sc7180_data = {
@@ -594,7 +592,7 @@ MODULE_DEVICE_TABLE(of, mdss_dt_match);
594592

595593
static struct platform_driver mdss_platform_driver = {
596594
.probe = mdss_probe,
597-
.remove = mdss_remove,
595+
.remove_new = mdss_remove,
598596
.driver = {
599597
.name = "msm-mdss",
600598
.of_match_table = mdss_dt_match,

0 commit comments

Comments
 (0)