drm/bridge: tpd12s015: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thu, 2 Nov 2023 16:56:47 +0000 (17:56 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Tue, 21 Nov 2023 08:17:53 +0000 (09:17 +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-24-u.kleine-koenig@pengutronix.de
drivers/gpu/drm/bridge/ti-tpd12s015.c

index b588fea12502d6845ec5790149da2548bbfadd25..f9fb35683a273955ce9d7dfd8da29dbf7dc6c6b3 100644 (file)
@@ -179,13 +179,11 @@ static int tpd12s015_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int tpd12s015_remove(struct platform_device *pdev)
+static void tpd12s015_remove(struct platform_device *pdev)
 {
        struct tpd12s015_device *tpd = platform_get_drvdata(pdev);
 
        drm_bridge_remove(&tpd->bridge);
-
-       return 0;
 }
 
 static const struct of_device_id tpd12s015_of_match[] = {
@@ -197,7 +195,7 @@ MODULE_DEVICE_TABLE(of, tpd12s015_of_match);
 
 static struct platform_driver tpd12s015_driver = {
        .probe  = tpd12s015_probe,
-       .remove = tpd12s015_remove,
+       .remove_new = tpd12s015_remove,
        .driver = {
                .name   = "tpd12s015",
                .of_match_table = tpd12s015_of_match,