From: Jonghwa Lee Date: Tue, 25 Jun 2013 05:18:14 +0000 (+0900) Subject: charger-manager: Fix regulator_get() return check X-Git-Tag: v3.11-rc1~52^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a6c2208455f25b3e6f939adc2da59aa00d4806e;p=profile%2Fivi%2Fkernel-x86-ivi.git 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 --- diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 8ad9698..e30e847 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;