drm/mediatek: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 7 May 2023 16:25:52 +0000 (18:25 +0200)
committerJavier Martinez Canillas <javierm@redhat.com>
Sat, 9 Sep 2023 14:12:26 +0000 (16:12 +0200)
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 <u.kleine-koenig@pengutronix.de>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230507162616.1368908-30-u.kleine-koenig@pengutronix.de
14 files changed:
drivers/gpu/drm/mediatek/mtk_disp_aal.c
drivers/gpu/drm/mediatek/mtk_disp_ccorr.c
drivers/gpu/drm/mediatek/mtk_disp_color.c
drivers/gpu/drm/mediatek/mtk_disp_gamma.c
drivers/gpu/drm/mediatek/mtk_disp_merge.c
drivers/gpu/drm/mediatek/mtk_disp_ovl.c
drivers/gpu/drm/mediatek/mtk_disp_rdma.c
drivers/gpu/drm/mediatek/mtk_dp.c
drivers/gpu/drm/mediatek/mtk_dpi.c
drivers/gpu/drm/mediatek/mtk_drm_drv.c
drivers/gpu/drm/mediatek/mtk_dsi.c
drivers/gpu/drm/mediatek/mtk_hdmi.c
drivers/gpu/drm/mediatek/mtk_hdmi_ddc.c
drivers/gpu/drm/mediatek/mtk_mdp_rdma.c

index cdbec79474d10635746b54079ec5a5d56a1d2e0d..136b1328e459edace15711ae9e16a1f87e148791 100644 (file)
@@ -139,11 +139,9 @@ static int mtk_disp_aal_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int mtk_disp_aal_remove(struct platform_device *pdev)
+static void mtk_disp_aal_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &mtk_disp_aal_component_ops);
-
-       return 0;
 }
 
 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);
 
 struct platform_driver mtk_disp_aal_driver = {
        .probe          = mtk_disp_aal_probe,
-       .remove         = mtk_disp_aal_remove,
+       .remove_new     = mtk_disp_aal_remove,
        .driver         = {
                .name   = "mediatek-disp-aal",
                .owner  = THIS_MODULE,
index 7c5e04ee5b9f5141e6485c6d5de1cb2a1cb60a7b..bd859008eff96cc7eae605b889ce2b2f3cf3a74f 100644 (file)
@@ -194,11 +194,9 @@ static int mtk_disp_ccorr_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int mtk_disp_ccorr_remove(struct platform_device *pdev)
+static void mtk_disp_ccorr_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &mtk_disp_ccorr_component_ops);
-
-       return 0;
 }
 
 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);
 
 struct platform_driver mtk_disp_ccorr_driver = {
        .probe          = mtk_disp_ccorr_probe,
-       .remove         = mtk_disp_ccorr_remove,
+       .remove_new     = mtk_disp_ccorr_remove,
        .driver         = {
                .name   = "mediatek-disp-ccorr",
                .owner  = THIS_MODULE,
index 0b9b4b06d19cc97121fe5656fe26f417760524c2..78ea99f1444faeb04feabb946e66bf6a0a3de51b 100644 (file)
@@ -131,11 +131,9 @@ static int mtk_disp_color_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int mtk_disp_color_remove(struct platform_device *pdev)
+static void mtk_disp_color_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &mtk_disp_color_component_ops);
-
-       return 0;
 }
 
 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);
 
 struct platform_driver mtk_disp_color_driver = {
        .probe          = mtk_disp_color_probe,
-       .remove         = mtk_disp_color_remove,
+       .remove_new     = mtk_disp_color_remove,
        .driver         = {
                .name   = "mediatek-disp-color",
                .owner  = THIS_MODULE,
index 7746dceadb20ee1751b568edcee903dea38ffc0c..673f9a5738f28f8ef418e744c3919093e28e76a7 100644 (file)
@@ -182,11 +182,9 @@ static int mtk_disp_gamma_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int mtk_disp_gamma_remove(struct platform_device *pdev)
+static void mtk_disp_gamma_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &mtk_disp_gamma_component_ops);
-
-       return 0;
 }
 
 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);
 
 struct platform_driver mtk_disp_gamma_driver = {
        .probe          = mtk_disp_gamma_probe,
-       .remove         = mtk_disp_gamma_remove,
+       .remove_new     = mtk_disp_gamma_remove,
        .driver         = {
                .name   = "mediatek-disp-gamma",
                .owner  = THIS_MODULE,
index bea8a0d8040ac0f17ed02d3ec5dc98816c22c700..e525a6b9e5b0bc257f6aea8e8dda8e4c47a22899 100644 (file)
@@ -294,11 +294,9 @@ static int mtk_disp_merge_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int mtk_disp_merge_remove(struct platform_device *pdev)
+static void mtk_disp_merge_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &mtk_disp_merge_component_ops);
-
-       return 0;
 }
 
 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);
 
 struct platform_driver mtk_disp_merge_driver = {
        .probe = mtk_disp_merge_probe,
-       .remove = mtk_disp_merge_remove,
+       .remove_new = mtk_disp_merge_remove,
        .driver = {
                .name = "mediatek-disp-merge",
                .owner = THIS_MODULE,
index 73320a7425cd4366357b221e9bc258326c1d2663..2bffe424546667ec3d3d2ce931bc55507e46e392 100644 (file)
@@ -561,12 +561,10 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int mtk_disp_ovl_remove(struct platform_device *pdev)
+static void mtk_disp_ovl_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &mtk_disp_ovl_component_ops);
        pm_runtime_disable(&pdev->dev);
-
-       return 0;
 }
 
 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);
 
 struct platform_driver mtk_disp_ovl_driver = {
        .probe          = mtk_disp_ovl_probe,
-       .remove         = mtk_disp_ovl_remove,
+       .remove_new     = mtk_disp_ovl_remove,
        .driver         = {
                .name   = "mediatek-disp-ovl",
                .owner  = THIS_MODULE,
index a12c05786d28635acd5cc9882a6c47a6910ccab6..faa907f2f443e36944f182b2b3b414ad44530d13 100644 (file)
@@ -379,13 +379,11 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int mtk_disp_rdma_remove(struct platform_device *pdev)
+static void mtk_disp_rdma_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &mtk_disp_rdma_component_ops);
 
        pm_runtime_disable(&pdev->dev);
-
-       return 0;
 }
 
 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);
 
 struct platform_driver mtk_disp_rdma_driver = {
        .probe          = mtk_disp_rdma_probe,
-       .remove         = mtk_disp_rdma_remove,
+       .remove_new     = mtk_disp_rdma_remove,
        .driver         = {
                .name   = "mediatek-disp-rdma",
                .owner  = THIS_MODULE,
index 64eee77452c043e4131a98941f3b073deed29c30..4dbc5be156f4fd7fb7f5948306a3f47f6ae539c5 100644 (file)
@@ -2574,7 +2574,7 @@ static int mtk_dp_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int mtk_dp_remove(struct platform_device *pdev)
+static void mtk_dp_remove(struct platform_device *pdev)
 {
        struct mtk_dp *mtk_dp = platform_get_drvdata(pdev);
 
@@ -2585,8 +2585,6 @@ static int mtk_dp_remove(struct platform_device *pdev)
        platform_device_unregister(mtk_dp->phy_dev);
        if (mtk_dp->audio_pdev)
                platform_device_unregister(mtk_dp->audio_pdev);
-
-       return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -2645,7 +2643,7 @@ MODULE_DEVICE_TABLE(of, mtk_dp_of_match);
 
 static struct platform_driver mtk_dp_driver = {
        .probe = mtk_dp_probe,
-       .remove = mtk_dp_remove,
+       .remove_new = mtk_dp_remove,
        .driver = {
                .name = "mediatek-drm-dp",
                .of_match_table = mtk_dp_of_match,
index 28bdb1f427ff52ac0d820efc995a66147f254677..0ef722c241507e9aae7897d56dd778429b53a275 100644 (file)
@@ -1101,14 +1101,12 @@ static int mtk_dpi_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int mtk_dpi_remove(struct platform_device *pdev)
+static void mtk_dpi_remove(struct platform_device *pdev)
 {
        struct mtk_dpi *dpi = platform_get_drvdata(pdev);
 
        component_del(&pdev->dev, &mtk_dpi_component_ops);
        drm_bridge_remove(&dpi->bridge);
-
-       return 0;
 }
 
 static const struct of_device_id mtk_dpi_of_ids[] = {
@@ -1139,7 +1137,7 @@ MODULE_DEVICE_TABLE(of, mtk_dpi_of_ids);
 
 struct platform_driver mtk_dpi_driver = {
        .probe = mtk_dpi_probe,
-       .remove = mtk_dpi_remove,
+       .remove_new = mtk_dpi_remove,
        .driver = {
                .name = "mediatek-dpi",
                .of_match_table = mtk_dpi_of_ids,
index 961715dd5b1169dbbc615ba6e4a1033fa00381cd..d16cc8219105da2e84126cfdeec5e55499b39bbe 100644 (file)
@@ -907,7 +907,7 @@ err_node:
        return ret;
 }
 
-static int mtk_drm_remove(struct platform_device *pdev)
+static void mtk_drm_remove(struct platform_device *pdev)
 {
        struct mtk_drm_private *private = platform_get_drvdata(pdev);
        int i;
@@ -917,8 +917,6 @@ static int mtk_drm_remove(struct platform_device *pdev)
        of_node_put(private->mutex_node);
        for (i = 0; i < DDP_COMPONENT_DRM_ID_MAX; i++)
                of_node_put(private->comp_node[i]);
-
-       return 0;
 }
 
 static int mtk_drm_sys_prepare(struct device *dev)
@@ -951,7 +949,7 @@ static const struct dev_pm_ops mtk_drm_pm_ops = {
 
 static struct platform_driver mtk_drm_platform_driver = {
        .probe  = mtk_drm_probe,
-       .remove = mtk_drm_remove,
+       .remove_new = mtk_drm_remove,
        .driver = {
                .name   = "mediatek-drm",
                .pm     = &mtk_drm_pm_ops,
index 7d525035119369801ce78d29361f7b8d83417f2e..d8bfc2cce54dc634cbe1d4c8675ad629046b14c3 100644 (file)
@@ -1178,14 +1178,12 @@ err_unregister_host:
        return ret;
 }
 
-static int mtk_dsi_remove(struct platform_device *pdev)
+static void mtk_dsi_remove(struct platform_device *pdev)
 {
        struct mtk_dsi *dsi = platform_get_drvdata(pdev);
 
        mtk_output_dsi_disable(dsi);
        mipi_dsi_host_unregister(&dsi->host);
-
-       return 0;
 }
 
 static const struct mtk_dsi_driver_data mt8173_dsi_driver_data = {
@@ -1223,7 +1221,7 @@ MODULE_DEVICE_TABLE(of, mtk_dsi_of_match);
 
 struct platform_driver mtk_dsi_driver = {
        .probe = mtk_dsi_probe,
-       .remove = mtk_dsi_remove,
+       .remove_new = mtk_dsi_remove,
        .driver = {
                .name = "mtk-dsi",
                .of_match_table = mtk_dsi_of_match,
index 0a8e0a13f516ce6f1340646f80d4eb8c2b3554c7..86133bf16326b1c42c2ac9bbf4447e925c860536 100644 (file)
@@ -1746,13 +1746,12 @@ err_bridge_remove:
        return ret;
 }
 
-static int mtk_drm_hdmi_remove(struct platform_device *pdev)
+static void mtk_drm_hdmi_remove(struct platform_device *pdev)
 {
        struct mtk_hdmi *hdmi = platform_get_drvdata(pdev);
 
        drm_bridge_remove(&hdmi->bridge);
        mtk_hdmi_clk_disable_audio(hdmi);
-       return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -1806,7 +1805,7 @@ MODULE_DEVICE_TABLE(of, mtk_drm_hdmi_of_ids);
 
 static struct platform_driver mtk_hdmi_driver = {
        .probe = mtk_drm_hdmi_probe,
-       .remove = mtk_drm_hdmi_remove,
+       .remove_new = mtk_drm_hdmi_remove,
        .driver = {
                .name = "mediatek-drm-hdmi",
                .of_match_table = mtk_drm_hdmi_of_ids,
index 4d39ea0a05ca4844cbfcd765ed4c1ca89af48126..d675c954befe3cc3ec833ca4ff838371d58727d4 100644 (file)
@@ -324,14 +324,12 @@ err_clk_disable:
        return ret;
 }
 
-static int mtk_hdmi_ddc_remove(struct platform_device *pdev)
+static void mtk_hdmi_ddc_remove(struct platform_device *pdev)
 {
        struct mtk_hdmi_ddc *ddc = platform_get_drvdata(pdev);
 
        i2c_del_adapter(&ddc->adap);
        clk_disable_unprepare(ddc->clk);
-
-       return 0;
 }
 
 static const struct of_device_id mtk_hdmi_ddc_match[] = {
@@ -342,7 +340,7 @@ MODULE_DEVICE_TABLE(of, mtk_hdmi_ddc_match);
 
 struct platform_driver mtk_hdmi_ddc_driver = {
        .probe = mtk_hdmi_ddc_probe,
-       .remove = mtk_hdmi_ddc_remove,
+       .remove_new = mtk_hdmi_ddc_remove,
        .driver = {
                .name = "mediatek-hdmi-ddc",
                .of_match_table = mtk_hdmi_ddc_match,
index 4806bdd4b8fa13fa54fa7964866eb036be2703af..c3adaeefd551a269c788e81ce89e19103912b0c9 100644 (file)
@@ -314,11 +314,10 @@ static int mtk_mdp_rdma_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int mtk_mdp_rdma_remove(struct platform_device *pdev)
+static void mtk_mdp_rdma_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &mtk_mdp_rdma_component_ops);
        pm_runtime_disable(&pdev->dev);
-       return 0;
 }
 
 static const struct of_device_id mtk_mdp_rdma_driver_dt_match[] = {
@@ -329,7 +328,7 @@ MODULE_DEVICE_TABLE(of, mtk_mdp_rdma_driver_dt_match);
 
 struct platform_driver mtk_mdp_rdma_driver = {
        .probe = mtk_mdp_rdma_probe,
-       .remove = mtk_mdp_rdma_remove,
+       .remove_new = mtk_mdp_rdma_remove,
        .driver = {
                .name = "mediatek-mdp-rdma",
                .owner = THIS_MODULE,