iommu/mtk_iommu_v1: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 21 Mar 2023 08:41:23 +0000 (09:41 +0100)
committerJoerg Roedel <jroedel@suse.de>
Fri, 31 Mar 2023 08:01:58 +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>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230321084125.337021-9-u.kleine-koenig@pengutronix.de
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/mtk_iommu_v1.c

index 43e4c8f89e23e24e7f82b9fc728d0fcc0c6ce14a..8a0a5e5d049f4aca4f3b53cd9f80900dfde5f4cf 100644 (file)
@@ -703,7 +703,7 @@ out_clk_unprepare:
        return ret;
 }
 
-static int mtk_iommu_v1_remove(struct platform_device *pdev)
+static void mtk_iommu_v1_remove(struct platform_device *pdev)
 {
        struct mtk_iommu_v1_data *data = platform_get_drvdata(pdev);
 
@@ -713,7 +713,6 @@ static int mtk_iommu_v1_remove(struct platform_device *pdev)
        clk_disable_unprepare(data->bclk);
        devm_free_irq(&pdev->dev, data->irq, data);
        component_master_del(&pdev->dev, &mtk_iommu_v1_com_ops);
-       return 0;
 }
 
 static int __maybe_unused mtk_iommu_v1_suspend(struct device *dev)
@@ -752,7 +751,7 @@ static const struct dev_pm_ops mtk_iommu_v1_pm_ops = {
 
 static struct platform_driver mtk_iommu_v1_driver = {
        .probe  = mtk_iommu_v1_probe,
-       .remove = mtk_iommu_v1_remove,
+       .remove_new = mtk_iommu_v1_remove,
        .driver = {
                .name = "mtk-iommu-v1",
                .of_match_table = mtk_iommu_v1_of_ids,