Skip to content

Commit

Permalink
charger-manager: Fix regulator_get() return check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jonghwa Lee authored and Anton Vorontsov committed Jun 29, 2013
1 parent 3cc9d26 commit 5a6c220
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/power/charger-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 5a6c220

Please sign in to comment.