* [PATCH] slimbus: Add a check on the return value of platform_device_add
@ 2018-12-24 16:56 Aditya Pakki
0 siblings, 0 replies; only message in thread
From: Aditya Pakki @ 2018-12-24 16:56 UTC (permalink / raw)
To: pakki001; +Cc: kjlu, Srinivas Kandagatla, alsa-devel, linux-kernel
In of_qcom_slim_ngd_register, the function platform_device_add() may fail.
The fix returns the error value upstream in case of failure.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
drivers/slimbus/qcom-ngd-ctrl.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index 1382a8df6c75..a2dffb2b4c88 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -1329,6 +1329,7 @@ static int of_qcom_slim_ngd_register(struct device *parent,
struct qcom_slim_ngd *ngd;
struct device_node *node;
u32 id;
+ int ret;
data = of_match_node(qcom_slim_ngd_dt_match, parent->of_node)->data;
@@ -1348,7 +1349,10 @@ static int of_qcom_slim_ngd_register(struct device *parent,
ctrl->ngd = ngd;
platform_set_drvdata(ngd->pdev, ctrl);
- platform_device_add(ngd->pdev);
+ ret = platform_device_add(ngd->pdev);
+ if (ret)
+ return ret;
+
ngd->base = ctrl->base + ngd->id * data->offset +
(ngd->id - 1) * data->size;
ctrl->ngd = ngd;
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-12-24 16:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-24 16:56 [PATCH] slimbus: Add a check on the return value of platform_device_add Aditya Pakki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.