media: radio-si476x: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 26 Mar 2023 14:32:06 +0000 (16:32 +0200)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Tue, 11 Apr 2023 14:59:20 +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/radio/radio-si476x.c

index 171f9cc9ee5ea43f992a1d3f32053dbaa6bdf10d..6061506159f1b4f30e3f61dd37f26364d2dc93eb 100644 (file)
@@ -1498,7 +1498,7 @@ exit:
        return rval;
 }
 
-static int si476x_radio_remove(struct platform_device *pdev)
+static void si476x_radio_remove(struct platform_device *pdev)
 {
        struct si476x_radio *radio = platform_get_drvdata(pdev);
 
@@ -1506,8 +1506,6 @@ static int si476x_radio_remove(struct platform_device *pdev)
        video_unregister_device(&radio->videodev);
        v4l2_device_unregister(&radio->v4l2dev);
        debugfs_remove_recursive(radio->debugfs);
-
-       return 0;
 }
 
 MODULE_ALIAS("platform:si476x-radio");
@@ -1517,7 +1515,7 @@ static struct platform_driver si476x_radio_driver = {
                .name   = DRIVER_NAME,
        },
        .probe          = si476x_radio_probe,
-       .remove         = si476x_radio_remove,
+       .remove_new     = si476x_radio_remove,
 };
 module_platform_driver(si476x_radio_driver);