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 <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>
This commit is contained in:
Jonghwa Lee 2013-06-25 14:18:14 +09:00 коммит произвёл Anton Vorontsov
Родитель 3cc9d26966
Коммит 5a6c220845
1 изменённых файлов: 2 добавлений и 3 удалений

Просмотреть файл

@ -1239,11 +1239,10 @@ static int charger_manager_register_extcon(struct charger_manager *cm)
charger->consumer = regulator_get(cm->dev, charger->consumer = regulator_get(cm->dev,
charger->regulator_name); charger->regulator_name);
if (charger->consumer == NULL) { if (IS_ERR(charger->consumer)) {
dev_err(cm->dev, "Cannot find charger(%s)\n", dev_err(cm->dev, "Cannot find charger(%s)\n",
charger->regulator_name); charger->regulator_name);
ret = -EINVAL; return PTR_ERR(charger->consumer);
goto err;
} }
charger->cm = cm; charger->cm = cm;