slimbus: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 30 Apr 2024 09:16:56 +0000 (10:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 May 2024 05:28:16 +0000 (07:28 +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 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 the slimbus drivers 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: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20240430091657.35428-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/slimbus/qcom-ctrl.c
drivers/slimbus/qcom-ngd-ctrl.c

index 400b7b385a443e93574c4ef8d3f814a2078e9bbd..7d632fad13005f3e4001d855ad3ea0371d840515 100644 (file)
@@ -626,7 +626,7 @@ err_request_irq_failed:
        return ret;
 }
 
-static int qcom_slim_remove(struct platform_device *pdev)
+static void qcom_slim_remove(struct platform_device *pdev)
 {
        struct qcom_slim_ctrl *ctrl = platform_get_drvdata(pdev);
 
@@ -635,7 +635,6 @@ static int qcom_slim_remove(struct platform_device *pdev)
        clk_disable_unprepare(ctrl->rclk);
        clk_disable_unprepare(ctrl->hclk);
        destroy_workqueue(ctrl->rxwq);
-       return 0;
 }
 
 /*
@@ -721,7 +720,7 @@ static const struct of_device_id qcom_slim_dt_match[] = {
 
 static struct platform_driver qcom_slim_driver = {
        .probe = qcom_slim_probe,
-       .remove = qcom_slim_remove,
+       .remove_new = qcom_slim_remove,
        .driver = {
                .name = "qcom_slim_ctrl",
                .of_match_table = qcom_slim_dt_match,
index 5e132273c6c4ad2a7f1cf844a51634fd66578cd9..a33b5f9090fe2a91aba84493dc0f66f89269c289 100644 (file)
@@ -1674,14 +1674,12 @@ err_pdr_lookup:
        return ret;
 }
 
-static int qcom_slim_ngd_ctrl_remove(struct platform_device *pdev)
+static void qcom_slim_ngd_ctrl_remove(struct platform_device *pdev)
 {
        platform_driver_unregister(&qcom_slim_ngd_driver);
-
-       return 0;
 }
 
-static int qcom_slim_ngd_remove(struct platform_device *pdev)
+static void qcom_slim_ngd_remove(struct platform_device *pdev)
 {
        struct qcom_slim_ngd_ctrl *ctrl = platform_get_drvdata(pdev);
 
@@ -1696,7 +1694,6 @@ static int qcom_slim_ngd_remove(struct platform_device *pdev)
 
        kfree(ctrl->ngd);
        ctrl->ngd = NULL;
-       return 0;
 }
 
 static int __maybe_unused qcom_slim_ngd_runtime_idle(struct device *dev)
@@ -1739,7 +1736,7 @@ static const struct dev_pm_ops qcom_slim_ngd_dev_pm_ops = {
 
 static struct platform_driver qcom_slim_ngd_ctrl_driver = {
        .probe = qcom_slim_ngd_ctrl_probe,
-       .remove = qcom_slim_ngd_ctrl_remove,
+       .remove_new = qcom_slim_ngd_ctrl_remove,
        .driver = {
                .name = "qcom,slim-ngd-ctrl",
                .of_match_table = qcom_slim_ngd_dt_match,
@@ -1748,7 +1745,7 @@ static struct platform_driver qcom_slim_ngd_ctrl_driver = {
 
 static struct platform_driver qcom_slim_ngd_driver = {
        .probe = qcom_slim_ngd_probe,
-       .remove = qcom_slim_ngd_remove,
+       .remove_new = qcom_slim_ngd_remove,
        .driver = {
                .name = QCOM_SLIM_NGD_DRV_NAME,
                .pm = &qcom_slim_ngd_dev_pm_ops,