From: tomasz.figa@gmail.com (Tomasz Figa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/5] pinctrl: samsung: Make samsung_pinctrl_get_soc_data use ERR_PTR()
Date: Thu, 2 Oct 2014 20:52:07 +0200 [thread overview]
Message-ID: <1412275931-10807-2-git-send-email-tomasz.figa@gmail.com> (raw)
In-Reply-To: <1412275931-10807-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>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---
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.1
next prev parent reply other threads:[~2014-10-02 18:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-02 18:52 [PATCH v2 0/5] pinctrl: samsung: Data structure clean-up Tomasz Figa
2014-10-02 18:52 ` Tomasz Figa [this message]
2014-10-02 18:52 ` [PATCH v2 2/5] pinctrl: samsung: Drop unused label field in samsung_pin_ctrl struct Tomasz Figa
2014-10-02 18:52 ` [PATCH v2 3/5] pinctrl: samsung: Constify samsung_pin_bank_type struct Tomasz Figa
2014-10-02 18:52 ` [PATCH v2 4/5] pinctrl: samsung: Constify samsung_pin_ctrl struct Tomasz Figa
2014-10-02 18:52 ` [PATCH v2 5/5] pinctrl: samsung: Separate per-bank init and runtime data Tomasz Figa
2014-10-08 10:23 ` [PATCH v2 0/5] pinctrl: samsung: Data structure clean-up Linus Walleij
2014-10-11 18:52 ` Tomasz Figa
2014-10-24 12:02 ` 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=1412275931-10807-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).