media: coda-common: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 26 Mar 2023 14:30:48 +0000 (16:30 +0200)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Tue, 11 Apr 2023 14:59:14 +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>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/chips-media/coda-common.c

index af71eea04dbd9f21cd7aba410e53e076199ffd2d..d013ea5d9d3d239195d09e2057236d61685958d6 100644 (file)
@@ -3300,7 +3300,7 @@ err_v4l2_register:
        return ret;
 }
 
-static int coda_remove(struct platform_device *pdev)
+static void coda_remove(struct platform_device *pdev)
 {
        struct coda_dev *dev = platform_get_drvdata(pdev);
        int i;
@@ -3322,7 +3322,6 @@ static int coda_remove(struct platform_device *pdev)
        coda_free_aux_buf(dev, &dev->workbuf);
        debugfs_remove_recursive(dev->debugfs_root);
        ida_destroy(&dev->ida);
-       return 0;
 }
 
 #ifdef CONFIG_PM
@@ -3347,7 +3346,7 @@ static const struct dev_pm_ops coda_pm_ops = {
 
 static struct platform_driver coda_driver = {
        .probe  = coda_probe,
-       .remove = coda_remove,
+       .remove_new = coda_remove,
        .driver = {
                .name   = CODA_NAME,
                .of_match_table = coda_dt_ids,