]> git.itanic.dy.fi Git - linux-stable/commitdiff
memory: mtk-smi: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 17 Dec 2023 14:29:33 +0000 (15:29 +0100)
committerKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tue, 19 Dec 2023 08:05:17 +0000 (09:05 +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>
Link: https://lore.kernel.org/r/5c35a33cfdc359842e034ddd2e9358f10e91fa1f.1702822744.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
drivers/memory/mtk-smi.c

index 6523cb51051827c6f247206986fb27e16ec2a456..572c7fbdcfd3a5b929eab83fa98865dd9226d2be 100644 (file)
@@ -566,14 +566,13 @@ static int mtk_smi_larb_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int mtk_smi_larb_remove(struct platform_device *pdev)
+static void mtk_smi_larb_remove(struct platform_device *pdev)
 {
        struct mtk_smi_larb *larb = platform_get_drvdata(pdev);
 
        device_link_remove(&pdev->dev, larb->smi_common_dev);
        pm_runtime_disable(&pdev->dev);
        component_del(&pdev->dev, &mtk_smi_larb_component_ops);
-       return 0;
 }
 
 static int __maybe_unused mtk_smi_larb_resume(struct device *dev)
@@ -616,7 +615,7 @@ static const struct dev_pm_ops smi_larb_pm_ops = {
 
 static struct platform_driver mtk_smi_larb_driver = {
        .probe  = mtk_smi_larb_probe,
-       .remove = mtk_smi_larb_remove,
+       .remove_new = mtk_smi_larb_remove,
        .driver = {
                .name = "mtk-smi-larb",
                .of_match_table = mtk_smi_larb_of_ids,
@@ -795,14 +794,13 @@ static int mtk_smi_common_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int mtk_smi_common_remove(struct platform_device *pdev)
+static void mtk_smi_common_remove(struct platform_device *pdev)
 {
        struct mtk_smi *common = dev_get_drvdata(&pdev->dev);
 
        if (common->plat->type == MTK_SMI_GEN2_SUB_COMM)
                device_link_remove(&pdev->dev, common->smi_common_dev);
        pm_runtime_disable(&pdev->dev);
-       return 0;
 }
 
 static int __maybe_unused mtk_smi_common_resume(struct device *dev)
@@ -842,7 +840,7 @@ static const struct dev_pm_ops smi_common_pm_ops = {
 
 static struct platform_driver mtk_smi_common_driver = {
        .probe  = mtk_smi_common_probe,
-       .remove = mtk_smi_common_remove,
+       .remove_new = mtk_smi_common_remove,
        .driver = {
                .name = "mtk-smi-common",
                .of_match_table = mtk_smi_common_of_ids,