iommu/ipmmu-vmsa: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 21 Mar 2023 08:41:20 +0000 (09:41 +0100)
committerJoerg Roedel <jroedel@suse.de>
Fri, 31 Mar 2023 08:01:57 +0000 (10:01 +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>
Link: https://lore.kernel.org/r/20230321084125.337021-6-u.kleine-koenig@pengutronix.de
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/ipmmu-vmsa.c

index bdf1a4e5eae00a687494a803da056d75a593f3df..813dbd1f7ba0887852812f162b73687a84ad23d7 100644 (file)
@@ -1073,7 +1073,7 @@ static int ipmmu_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int ipmmu_remove(struct platform_device *pdev)
+static void ipmmu_remove(struct platform_device *pdev)
 {
        struct ipmmu_vmsa_device *mmu = platform_get_drvdata(pdev);
 
@@ -1083,8 +1083,6 @@ static int ipmmu_remove(struct platform_device *pdev)
        arm_iommu_release_mapping(mmu->mapping);
 
        ipmmu_device_reset(mmu);
-
-       return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -1131,6 +1129,6 @@ static struct platform_driver ipmmu_driver = {
                .pm = DEV_PM_OPS,
        },
        .probe = ipmmu_probe,
-       .remove = ipmmu_remove,
+       .remove_new = ipmmu_remove,
 };
 builtin_platform_driver(ipmmu_driver);