From: Axel Lin <axel.lin@ingics.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
spear-devel@list.st.com, linux-kernel@vger.kernel.org
Subject: [PATCH] pinctrl: spear: Make get_gpio_pingroup return NULL when no gpio_pingroup found
Date: Tue, 13 Nov 2012 20:20:50 +0800 [thread overview]
Message-ID: <1352809250.4819.1.camel@phoenix> (raw)
Currently get_gpio_pingroup() may return NULL or ERR_PTR(-EINVAL) when
no gpio_pingroup found. The caller in gpio_request_endisable() only
checks if the return value is NULL. Return ERR_PTR(-EINVAL) for
get_gpio_pingroup() causes problem and seems not necessary.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/pinctrl/spear/pinctrl-spear.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c
index 107780c..42bc267 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.c
+++ b/drivers/pinctrl/spear/pinctrl-spear.c
@@ -284,12 +284,12 @@ static struct spear_gpio_pingroup *get_gpio_pingroup(struct spear_pmx *pmx,
unsigned pin)
{
struct spear_gpio_pingroup *gpio_pingroup;
- int i = 0, j;
+ int i, j;
if (!pmx->machdata->gpio_pingroups)
return NULL;
- for (; i < pmx->machdata->ngpio_pingroups; i++) {
+ for (i = 0; i < pmx->machdata->ngpio_pingroups; i++) {
gpio_pingroup = &pmx->machdata->gpio_pingroups[i];
for (j = 0; j < gpio_pingroup->npins; j++) {
@@ -298,7 +298,7 @@ static struct spear_gpio_pingroup *get_gpio_pingroup(struct spear_pmx *pmx,
}
}
- return ERR_PTR(-EINVAL);
+ return NULL;
}
static int gpio_request_endisable(struct pinctrl_dev *pctldev,
--
1.7.9.5
next reply other threads:[~2012-11-13 12:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-13 12:20 Axel Lin [this message]
2012-11-15 11:32 ` [PATCH] pinctrl: spear: Make get_gpio_pingroup return NULL when no gpio_pingroup found 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=1352809250.4819.1.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=spear-devel@list.st.com \
--cc=viresh.kumar@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.