From: Jonghwa Lee <jonghwa3.lee@samsung.com>
To: anton.vorontsov@linaro.org
Cc: linux-kernel@vger.kernel.org,
Jonghwa Lee <jonghwa3.lee@samsung.com>,
Myungjoo Ham <myungjoo.ham@samsung.com>
Subject: [PATCH v2] power: charger-manager: regulator_get() never returns NULL.
Date: Tue, 25 Jun 2013 14:18:14 +0900 [thread overview]
Message-ID: <1372137494-4268-1-git-send-email-jonghwa3.lee@samsung.com> (raw)
This patch fixes return value checking of regulator_get() in charger-manager
driver. The API, regulator_get(), returns ERR_PTR() when it fails to get
regulator with given name, not NULL.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
---
v2:
- Fix return value to use API's directly with PTR_ERR().
drivers/power/charger-manager.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
index ba42029..0a4cce3 100644
--- a/drivers/power/charger-manager.c
+++ b/drivers/power/charger-manager.c
@@ -1239,11 +1239,10 @@ static int charger_manager_register_extcon(struct charger_manager *cm)
charger->consumer = regulator_get(cm->dev,
charger->regulator_name);
- if (charger->consumer == NULL) {
+ if (IS_ERR(charger->consumer)) {
dev_err(cm->dev, "Cannot find charger(%s)\n",
charger->regulator_name);
- ret = -EINVAL;
- goto err;
+ return PTR_ERR(charger->consumer);
}
charger->cm = cm;
--
1.7.9.5
next reply other threads:[~2013-06-25 5:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 5:18 Jonghwa Lee [this message]
[not found] ` <CAGTfZH1HfyDOh+9wwXO_=4g38_7Y4PavxpsU9+o4vJyCUbALhw@mail.gmail.com>
2013-06-29 1:39 ` Anton Vorontsov
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=1372137494-4268-1-git-send-email-jonghwa3.lee@samsung.com \
--to=jonghwa3.lee@samsung.com \
--cc=anton.vorontsov@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
/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
all inboxes | Powered by JetHome®