charger-manager: Fix regulator_get() return check
authorJonghwa Lee <jonghwa3.lee@samsung.com>
Tue, 25 Jun 2013 05:18:14 +0000 (14:18 +0900)
committerAnton Vorontsov <anton@enomsg.org>
Sat, 29 Jun 2013 01:37:03 +0000 (18:37 -0700)
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>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
drivers/power/charger-manager.c

index 8ad9698b55a950321b39eba5b765eaee0e2dbb05..e30e847600bb69c71519b7e1325286830e504c53 100644 (file)
@@ -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;