linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tomasz.figa@gmail.com (Tomasz Figa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] pinctrl: samsung: Make samsung_pinctrl_get_soc_data use ERR_PTR()
Date: Tue, 23 Sep 2014 21:05:37 +0200	[thread overview]
Message-ID: <1411499141-26551-2-git-send-email-tomasz.figa@gmail.com> (raw)
In-Reply-To: <1411499141-26551-1-git-send-email-tomasz.figa@gmail.com>

Currently the function returns a valid pointer on success and NULL on
error, so exact error code is lost. This patch changes return convention
of the function to use ERR_PTR() on error instead.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
---
 drivers/pinctrl/samsung/pinctrl-samsung.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/samsung/pinctrl-samsung.c b/drivers/pinctrl/samsung/pinctrl-samsung.c
index 4a47691c32b1..0504f0b75de8 100644
--- a/drivers/pinctrl/samsung/pinctrl-samsung.c
+++ b/drivers/pinctrl/samsung/pinctrl-samsung.c
@@ -988,7 +988,7 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data(
 	id = of_alias_get_id(node, "pinctrl");
 	if (id < 0) {
 		dev_err(&pdev->dev, "failed to get alias id\n");
-		return NULL;
+		return ERR_PTR(-ENOENT);
 	}
 	match = of_match_node(samsung_pinctrl_dt_match, node);
 	ctrl = (struct samsung_pin_ctrl *)match->data + id;
@@ -1040,9 +1040,9 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)
 	}
 
 	ctrl = samsung_pinctrl_get_soc_data(drvdata, pdev);
-	if (!ctrl) {
+	if (IS_ERR(ctrl)) {
 		dev_err(&pdev->dev, "driver data not available\n");
-		return -EINVAL;
+		return PTR_ERR(ctrl);
 	}
 	drvdata->ctrl = ctrl;
 	drvdata->dev = dev;
-- 
2.1.0

  reply	other threads:[~2014-09-23 19:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23 19:05 [PATCH 0/5] pinctrl: samsung: Data structure clean-up Tomasz Figa
2014-09-23 19:05 ` Tomasz Figa [this message]
2014-09-23 19:05 ` [PATCH 2/5] pinctrl: samsung: Drop unused label field in samsung_pin_ctrl struct Tomasz Figa
2014-09-23 19:05 ` [PATCH 3/5] pinctrl: samsung: Constify samsung_pin_bank_type struct Tomasz Figa
2014-09-23 19:05 ` [PATCH 4/5] pinctrl: samsung: Constify samsung_pin_ctrl struct Tomasz Figa
2014-09-23 19:05 ` [PATCH 5/5] pinctrl: samsung: Separate per-bank init and runtime data Tomasz Figa
2014-09-24  7:25 ` [PATCH 0/5] pinctrl: samsung: Data structure clean-up Marek Szyprowski
2014-09-25  9:58   ` Javier Martinez Canillas
2014-09-25  7:47 ` Linus Walleij
2014-09-25  7:49   ` Tomasz Figa
2014-09-27 12:50     ` Tomasz Figa
2014-10-02  7:18       ` Linus Walleij

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=1411499141-26551-2-git-send-email-tomasz.figa@gmail.com \
    --to=tomasz.figa@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).