All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aditya Pakki <pakki001@umn.edu>
To: pakki001@umn.edu
Cc: kjlu@umn.edu,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: [PATCH] slimbus: Add a check on the return value of platform_device_add
Date: Mon, 24 Dec 2018 10:56:59 -0600	[thread overview]
Message-ID: <20181224165659.18448-1-pakki001@umn.edu> (raw)

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


                 reply	other threads:[~2018-12-24 16:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181224165659.18448-1-pakki001@umn.edu \
    --to=pakki001@umn.edu \
    --cc=alsa-devel@alsa-project.org \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.