From: Peng Fan <van.freenix@gmail.com>
To: linus.walleij@linaro.org, linux-kernel@vger.kernel.org
Cc: linux-gpio@vger.kernel.org, van.freenix@gmail.com
Subject: [PATCH] pinctrl: core: handle pinctrl_get failure
Date: Thu, 10 Sep 2015 21:38:06 +0800 [thread overview]
Message-ID: <1441892286-18989-1-git-send-email-van.freenix@gmail.com> (raw)
Need to do error handling path when pinctrl_get fails. Also when
pinctrl_get success, insert 'pctldev->node' to pinctrldev_list.
Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
drivers/pinctrl/core.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 69723e0..ae6f9b6 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1753,10 +1753,6 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
goto out_err;
}
- mutex_lock(&pinctrldev_list_mutex);
- list_add_tail(&pctldev->node, &pinctrldev_list);
- mutex_unlock(&pinctrldev_list_mutex);
-
pctldev->p = pinctrl_get(pctldev->dev);
if (!IS_ERR(pctldev->p)) {
@@ -1776,8 +1772,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
PINCTRL_STATE_SLEEP);
if (IS_ERR(pctldev->hog_sleep))
dev_dbg(dev, "failed to lookup the sleep state\n");
+ } else {
+ goto out_err;
}
+ mutex_lock(&pinctrldev_list_mutex);
+ list_add_tail(&pctldev->node, &pinctrldev_list);
+ mutex_unlock(&pinctrldev_list_mutex);
+
pinctrl_init_device_debugfs(pctldev);
return pctldev;
--
1.8.4
next reply other threads:[~2015-09-10 13:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-10 13:38 Peng Fan [this message]
2015-09-25 17:23 ` 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=1441892286-18989-1-git-send-email-van.freenix@gmail.com \
--to=van.freenix@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome