lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-id: <1372137494-4268-1-git-send-email-jonghwa3.lee@samsung.com>
Date:	Tue, 25 Jun 2013 14:18:14 +0900
From:	Jonghwa Lee <jonghwa3.lee@...sung.com>
To:	anton.vorontsov@...aro.org
Cc:	linux-kernel@...r.kernel.org,
	Jonghwa Lee <jonghwa3.lee@...sung.com>,
	Myungjoo Ham <myungjoo.ham@...sung.com>
Subject: [PATCH v2] power: charger-manager: regulator_get() never returns NULL.

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@...sung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@...sung.com>
---
v2:
 - Fix return value to use API's directly with PTR_ERR().

 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 ba42029..0a4cce3 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;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ