media: nxp: imx8-isi: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 23 Feb 2024 12:59:06 +0000 (13:59 +0100)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 28 Feb 2024 15:00:32 +0000 (16:00 +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>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c

index f73facb97dc5036d111ceeb31897832140519ceb..c2013995049c603af2a57ddd326abc84450e5d95 100644 (file)
@@ -506,7 +506,7 @@ err_pm:
        return ret;
 }
 
-static int mxc_isi_remove(struct platform_device *pdev)
+static void mxc_isi_remove(struct platform_device *pdev)
 {
        struct mxc_isi_dev *isi = platform_get_drvdata(pdev);
        unsigned int i;
@@ -523,8 +523,6 @@ static int mxc_isi_remove(struct platform_device *pdev)
        mxc_isi_v4l2_cleanup(isi);
 
        pm_runtime_disable(isi->dev);
-
-       return 0;
 }
 
 static const struct of_device_id mxc_isi_of_match[] = {
@@ -537,7 +535,7 @@ MODULE_DEVICE_TABLE(of, mxc_isi_of_match);
 
 static struct platform_driver mxc_isi_driver = {
        .probe          = mxc_isi_probe,
-       .remove         = mxc_isi_remove,
+       .remove_new     = mxc_isi_remove,
        .driver = {
                .of_match_table = mxc_isi_of_match,
                .name           = MXC_ISI_DRIVER_NAME,