mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
charger-manager: Fix regulator_get() return check
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 <[email protected]> Signed-off-by: Myungjoo Ham <[email protected]> Acked-by: Chanwoo Choi <[email protected]> Signed-off-by: Anton Vorontsov <[email protected]>
This commit is contained in:
parent
3cc9d26966
commit
5a6c220845
1 changed files with 2 additions and 3 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue