interconnect: qcom: Make qnoc_remove return void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 31 Oct 2023 22:28:53 +0000 (23:28 +0100)
committerGeorgi Djakov <djakov@kernel.org>
Wed, 22 Nov 2023 13:57:07 +0000 (15:57 +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().

Several interconnect/qcom drivers use qnoc_remove() as remove callback.
Make this function return void (instead of unconditionally zero) and
adapt the drivers using this function accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20231031222851.3126434-12-u.kleine-koenig@pengutronix.de
Signed-off-by: Georgi Djakov <djakov@kernel.org>
drivers/interconnect/qcom/icc-rpm.c
drivers/interconnect/qcom/icc-rpm.h
drivers/interconnect/qcom/msm8916.c
drivers/interconnect/qcom/msm8939.c
drivers/interconnect/qcom/msm8996.c
drivers/interconnect/qcom/qcm2290.c
drivers/interconnect/qcom/qcs404.c
drivers/interconnect/qcom/sdm660.c

index 628e651c555cb0aaf0003b79d3897ebbd989fbe4..fb54e78f8fd7482b482c65d75bf504f5e90413a1 100644 (file)
@@ -627,14 +627,12 @@ err_disable_unprepare_clk:
 }
 EXPORT_SYMBOL(qnoc_probe);
 
-int qnoc_remove(struct platform_device *pdev)
+void qnoc_remove(struct platform_device *pdev)
 {
        struct qcom_icc_provider *qp = platform_get_drvdata(pdev);
 
        icc_provider_deregister(&qp->provider);
        icc_nodes_remove(&qp->provider);
        clk_disable_unprepare(qp->bus_clk);
-
-       return 0;
 }
 EXPORT_SYMBOL(qnoc_remove);
index a13768cfd2311ed4b7d4bb7b9827b7121deb02a9..f4883d43eae4d3c05c9d5dba619433a3b2716910 100644 (file)
@@ -161,7 +161,7 @@ extern const struct rpm_clk_resource aggre1_branch_clk;
 extern const struct rpm_clk_resource aggre2_branch_clk;
 
 int qnoc_probe(struct platform_device *pdev);
-int qnoc_remove(struct platform_device *pdev);
+void qnoc_remove(struct platform_device *pdev);
 
 bool qcom_icc_rpm_smd_available(void);
 int qcom_icc_rpm_smd_send(int ctx, int rsc_type, int id, u32 val);
index 35148880b3e87de86e78977390a7bd988f52e1c3..499b1a9ac413bf52a587e81969e4f2e72e745049 100644 (file)
@@ -1344,7 +1344,7 @@ MODULE_DEVICE_TABLE(of, msm8916_noc_of_match);
 
 static struct platform_driver msm8916_noc_driver = {
        .probe = qnoc_probe,
-       .remove = qnoc_remove,
+       .remove_new = qnoc_remove,
        .driver = {
                .name = "qnoc-msm8916",
                .of_match_table = msm8916_noc_of_match,
index b52c5ac1175c3fa458007b13906bba92219368db..8ff2c23b1ca0dd8759290190931f7e294a4e2d3d 100644 (file)
@@ -1421,7 +1421,7 @@ MODULE_DEVICE_TABLE(of, msm8939_noc_of_match);
 
 static struct platform_driver msm8939_noc_driver = {
        .probe = qnoc_probe,
-       .remove = qnoc_remove,
+       .remove_new = qnoc_remove,
        .driver = {
                .name = "qnoc-msm8939",
                .of_match_table = msm8939_noc_of_match,
index b73566c9b21f9dd275878419e030ab07163ef8dd..788131400cd132a4d963503db24efaf05ce7a46b 100644 (file)
@@ -2108,7 +2108,7 @@ MODULE_DEVICE_TABLE(of, qnoc_of_match);
 
 static struct platform_driver qnoc_driver = {
        .probe = qnoc_probe,
-       .remove = qnoc_remove,
+       .remove_new = qnoc_remove,
        .driver = {
                .name = "qnoc-msm8996",
                .of_match_table = qnoc_of_match,
index b88cf9a022e035fe5ba1981b79e948e2472d3218..96735800b13c099b577c03ee673756503e2174b8 100644 (file)
@@ -1367,7 +1367,7 @@ MODULE_DEVICE_TABLE(of, qcm2290_noc_of_match);
 
 static struct platform_driver qcm2290_noc_driver = {
        .probe = qnoc_probe,
-       .remove = qnoc_remove,
+       .remove_new = qnoc_remove,
        .driver = {
                .name = "qnoc-qcm2290",
                .of_match_table = qcm2290_noc_of_match,
index 9fa1da70c843a2a0a5cef3d9240720875c017380..11b49a89c03d14149dd22637f0ad898bb083139e 100644 (file)
@@ -1083,7 +1083,7 @@ MODULE_DEVICE_TABLE(of, qcs404_noc_of_match);
 
 static struct platform_driver qcs404_noc_driver = {
        .probe = qnoc_probe,
-       .remove = qnoc_remove,
+       .remove_new = qnoc_remove,
        .driver = {
                .name = "qnoc-qcs404",
                .of_match_table = qcs404_noc_of_match,
index 7392bebba3344fbf65e0dc36378e8c3fe5f3ae18..ab91de446da8818e31b6b8ddd30064f2592521f1 100644 (file)
@@ -1714,7 +1714,7 @@ MODULE_DEVICE_TABLE(of, sdm660_noc_of_match);
 
 static struct platform_driver sdm660_noc_driver = {
        .probe = qnoc_probe,
-       .remove = qnoc_remove,
+       .remove_new = qnoc_remove,
        .driver = {
                .name = "qnoc-sdm660",
                .of_match_table = sdm660_noc_of_match,