From 5a6c2208455f25b3e6f939adc2da59aa00d4806e Mon Sep 17 00:00:00 2001 From: Jonghwa Lee Date: Tue, 25 Jun 2013 14:18:14 +0900 Subject: [PATCH] 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 Signed-off-by: Myungjoo Ham Acked-by: Chanwoo Choi Signed-off-by: Anton Vorontsov --- 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 8ad9698b55a9..e30e847600bb 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;