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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 28 Jun 2013 21:34:14 +0800
From:	Axel Lin <axel.lin@...ics.com>
To:	Mark Brown <broonie@...nel.org>
Cc:	Yi Zhang <yizhang@...vell.com>, Chao Xie <chao.xie@...vell.com>,
	Liam Girdwood <lgirdwood@...il.com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] regulator: 88pm800: Remove NULL test for
 regulator_unregister()

It's safe to call regulator_unregister with NULL.
In additional, having NULL check in the for loop is wrong because
the for loop exits if pm800_data->regulators[i] is NULL.
So we have have some regulators remains registered.

Signed-off-by: Axel Lin <axel.lin@...ics.com>
---
 drivers/regulator/88pm800.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/88pm800.c b/drivers/regulator/88pm800.c
index afa3762..1fc1899 100644
--- a/drivers/regulator/88pm800.c
+++ b/drivers/regulator/88pm800.c
@@ -405,7 +405,7 @@ static int pm800_regulator_probe(struct platform_device *pdev)
 			dev_err(&pdev->dev, "Failed to register %s\n",
 				info->desc.name);
 
-			while (--i >= 0 && pm800_data->regulators[i])
+			while (--i >= 0)
 				regulator_unregister(pm800_data->regulators[i]);
 
 			return ret;
@@ -420,7 +420,7 @@ static int pm800_regulator_remove(struct platform_device *pdev)
 	struct pm800_regulators *pm800_data = platform_get_drvdata(pdev);
 	int i;
 
-	for (i = 0; pm800_data->regulators[i] && i < PM800_ID_RG_MAX; i++)
+	for (i = 0; i < PM800_ID_RG_MAX; i++)
 		regulator_unregister(pm800_data->regulators[i]);
 
 	return 0;
-- 
1.8.1.2



--
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