drm/mediatek: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 2 Nov 2023 16:56:53 +0000 (17:56 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Tue, 21 Nov 2023 08:18:53 +0000 (09:18 +0100)
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 ignored (apart
from emitting a warning) 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. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

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>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20231102165640.3307820-30-u.kleine-koenig@pengutronix.de
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
drivers/gpu/drm/mediatek/mtk_ethdr.c

index 6bf6367..3fdef3a 100644 (file)
@@ -531,16 +531,15 @@ static int mtk_disp_ovl_adaptor_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int mtk_disp_ovl_adaptor_remove(struct platform_device *pdev)
+static void mtk_disp_ovl_adaptor_remove(struct platform_device *pdev)
 {
        component_master_del(&pdev->dev, &mtk_disp_ovl_adaptor_master_ops);
        pm_runtime_disable(&pdev->dev);
-       return 0;
 }
 
 struct platform_driver mtk_disp_ovl_adaptor_driver = {
        .probe          = mtk_disp_ovl_adaptor_probe,
-       .remove         = mtk_disp_ovl_adaptor_remove,
+       .remove_new     = mtk_disp_ovl_adaptor_remove,
        .driver         = {
                .name   = "mediatek-disp-ovl-adaptor",
                .owner  = THIS_MODULE,
index db7ac66..6a5d0c3 100644 (file)
@@ -346,10 +346,9 @@ static int mtk_ethdr_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int mtk_ethdr_remove(struct platform_device *pdev)
+static void mtk_ethdr_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &mtk_ethdr_component_ops);
-       return 0;
 }
 
 static const struct of_device_id mtk_ethdr_driver_dt_match[] = {
@@ -361,7 +360,7 @@ MODULE_DEVICE_TABLE(of, mtk_ethdr_driver_dt_match);
 
 struct platform_driver mtk_ethdr_driver = {
        .probe          = mtk_ethdr_probe,
-       .remove         = mtk_ethdr_remove,
+       .remove_new     = mtk_ethdr_remove,
        .driver         = {
                .name   = "mediatek-disp-ethdr",
                .owner  = THIS_MODULE,