Add the check for the return value of platform_driver_register
in order to catch the exception.
Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")
Signed-off-by: Jiasheng Jiang <jiasheng@xxxxxxxxxxx>
---
drivers/slimbus/qcom-ngd-ctrl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index 76c5e446d243..c16fc9e6d1c6 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -1590,7 +1590,10 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev)
goto err_pdr_lookup;
}
- platform_driver_register(&qcom_slim_ngd_driver);
+ ret = platform_driver_register(&qcom_slim_ngd_driver);
+ if (ret < 0)
+ goto err_pdr_lookup; > +
return of_qcom_slim_ngd_register(dev, ctrl);
err_pdr_alloc: