[PATCH] slimbus: qcom-ngd-ctrl: Add check for platform_driver_register

williamsukatube at 163.com williamsukatube at 163.com
Sat Jul 23 05:23:28 CEST 2022


From: William Dean <williamsukatube at gmail.com>

As platform_driver_register() could fail, it should be better
to deal with the return value in order to maintain the code
consisitency.

Fixes: 1830dad34c070 ("slimbus: ngd: register ngd driver only once.")
Reported-by: Hacash Robot <hacashRobot at santino.com>
Signed-off-by: William Dean <williamsukatube at gmail.com>
---
 drivers/slimbus/qcom-ngd-ctrl.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index 0aa8408464ad..a31ec00a37ac 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -1585,7 +1585,12 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev)
 		return PTR_ERR(pds);
 	}
 
-	platform_driver_register(&qcom_slim_ngd_driver);
+	ret = platform_driver_register(&qcom_slim_ngd_driver);
+	if (ret) {
+		dev_err(dev, "platform driver register failed: %d\n", ret);
+		return ret;
+	}
+
 	return of_qcom_slim_ngd_register(dev, ctrl);
 }
 
-- 
2.25.1



More information about the Alsa-devel mailing list