media: rcar_drif: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 26 Mar 2023 14:31:18 +0000 (16:31 +0200)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Tue, 11 Apr 2023 14:59:16 +0000 (16:59 +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 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>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/renesas/rcar_drif.c

index 3fec41f6e964557ac68ac5d476e6b71043e89597..3a92f4535c18bccde7a84a167f56dbc17f715c8b 100644 (file)
@@ -1433,19 +1433,17 @@ static int rcar_drif_probe(struct platform_device *pdev)
 }
 
 /* DRIF channel remove */
-static int rcar_drif_remove(struct platform_device *pdev)
+static void rcar_drif_remove(struct platform_device *pdev)
 {
        struct rcar_drif *ch = platform_get_drvdata(pdev);
        struct rcar_drif_sdr *sdr = ch->sdr;
 
        /* Channel 0 will be the SDR instance */
        if (ch->num)
-               return 0;
+               return;
 
        /* SDR instance */
        rcar_drif_sdr_remove(sdr);
-
-       return 0;
 }
 
 /* FIXME: Implement suspend/resume support */
@@ -1476,7 +1474,7 @@ static struct platform_driver rcar_drif_driver = {
                .pm = &rcar_drif_pm_ops,
                },
        .probe = rcar_drif_probe,
-       .remove = rcar_drif_remove,
+       .remove_new = rcar_drif_remove,
 };
 
 module_platform_driver(rcar_drif_driver);