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-next>] [day] [month] [year] [list]
Message-ID: <89bb50f4d48d061408b554a16b879464e471c17a.1507912080.git.leonard.crestez@nxp.com>
Date:   Fri, 13 Oct 2017 19:37:31 +0300
From:   Leonard Crestez <leonard.crestez@....com>
To:     Pierre-Hugues Husson <phh@....me>, Mark Brown <broonie@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>
CC:     Lee Jones <lee.jones@...aro.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] regulator: rn5t618: Do not index regulator_desc arrays by id

The regulator_desc arrays in this driver are indexed by RN5T618_*
constants and some elements can be missing. This causes probe failures
on older models:

rn5t618-regulator rn5t618-regulator: failed to register (null) regulator
rn5t618-regulator: probe of rn5t618-regulator failed with error -22

Fix this by making the arrays flat. This also saves a little memory
because the regulator_desc arrays become smaller.

Signed-off-by: Leonard Crestez <leonard.crestez@....com>
Fixes: 83b2a3c2ab24 ("regulator: rn5t618: add RC5T619 PMIC support")

---
An alternative would be to restore the check if (!regulators[i].name)

See also: https://lkml.org/lkml/2017/10/13/632

 drivers/regulator/rn5t618-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/rn5t618-regulator.c b/drivers/regulator/rn5t618-regulator.c
index ef2be56..790a4a7 100644
--- a/drivers/regulator/rn5t618-regulator.c
+++ b/drivers/regulator/rn5t618-regulator.c
@@ -29,7 +29,7 @@ static const struct regulator_ops rn5t618_reg_ops = {
 };
 
 #define REG(rid, ereg, emask, vreg, vmask, min, max, step)		\
-	[RN5T618_##rid] = {						\
+	{								\
 		.name		= #rid,					\
 		.of_match	= of_match_ptr(#rid),			\
 		.regulators_node = of_match_ptr("regulators"),		\
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ