mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] power: charger-manager: regulator_get() never returns NULL.
@ 2013-06-25  5:18 Jonghwa Lee
       [not found] ` <CAGTfZH1HfyDOh+9wwXO_=4g38_7Y4PavxpsU9+o4vJyCUbALhw@mail.gmail.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Jonghwa Lee @ 2013-06-25  5:18 UTC (permalink / raw)
  To: anton.vorontsov; +Cc: linux-kernel, Jonghwa Lee, Myungjoo Ham

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] power: charger-manager: regulator_get() never returns NULL.
       [not found] ` <CAGTfZH1HfyDOh+9wwXO_=4g38_7Y4PavxpsU9+o4vJyCUbALhw@mail.gmail.com>
@ 2013-06-29  1:39   ` Anton Vorontsov
  0 siblings, 0 replies; 2+ messages in thread
From: Anton Vorontsov @ 2013-06-29  1:39 UTC (permalink / raw)
  To: Chanwoo Choi; +Cc: Jonghwa Lee, linux-kernel, Myungjoo Ham

On Tue, Jun 25, 2013 at 02:54:17PM +0900, Chanwoo Choi wrote:
> Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
> 
> > 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>

1/2 v2 and 2/2 applied.

Thanks!

Anton

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-29  1:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-25  5:18 [PATCH v2] power: charger-manager: regulator_get() never returns NULL Jonghwa Lee
     [not found] ` <CAGTfZH1HfyDOh+9wwXO_=4g38_7Y4PavxpsU9+o4vJyCUbALhw@mail.gmail.com>
2013-06-29  1:39   ` Anton Vorontsov

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®