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]
Message-id: <1426878127-13497-3-git-send-email-b.zolnierkie@samsung.com>
Date:	Fri, 20 Mar 2015 20:02:04 +0100
From:	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
To:	Lee Jones <lee.jones@...aro.org>,
	Samuel Ortiz <sameo@...ux.intel.com>
Cc:	Johan Hovold <johan@...nel.org>,
	Support Opensource <support.opensource@...semi.com>,
	Milo Kim <milo.kim@...com>,
	patches@...nsource.wolfsonmicro.com,
	Fabio Estevam <fabio.estevam@...escale.com>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	linux-kernel@...r.kernel.org, b.zolnierkie@...sung.com
Subject: [PATCH 2/5] mfd: da9055: Fix platform device ids to avoid probe failure

Commit 6e3f62f0793e ("mfd: core: Fix platform-device id generation")
changed the way platform device ids are generated from mfd id base and
cell ids in mfd_add_device().  Unfortunately the change in question
breaks mfd drivers which are using mfd_add_devices() with mfd id base
equal to -1 and non-zero cell ids (used to distinguish cells with
the same name field).  The result is that mfd core tries to register
platform devices with the same name which obviously fails and leads
to mfd device probe failure.

Changing mfd_add_devices() mfd id base from -1 to 0 and at the same
time setting proper cell ids for all cells fixes the issue.

Fixes: 6e3f62f0793e ("mfd: core: Fix platform-device id generation")
Cc: Johan Hovold <johan@...nel.org>
Cc: Support Opensource <support.opensource@...semi.com>
Cc: <stable@...r.kernel.org> # v3.19+
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
---
 drivers/mfd/da9055-core.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
index b4d920c..4dbe752 100644
--- a/drivers/mfd/da9055-core.c
+++ b/drivers/mfd/da9055-core.c
@@ -298,6 +298,12 @@ static const struct mfd_cell da9055_devs[] = {
 	{
 		.of_compatible = "dlg,da9055-gpio",
 		.name = "da9055-gpio",
+		.id = -1,
+	},
+	{
+		.of_compatible = "dlg,da9055-regulator",
+		.name = "da9055-regulator",
+		.id = 0,
 	},
 	{
 		.of_compatible = "dlg,da9055-regulator",
@@ -327,43 +333,42 @@ static const struct mfd_cell da9055_devs[] = {
 	{
 		.of_compatible = "dlg,da9055-regulator",
 		.name = "da9055-regulator",
-		.id = 6,
-	},
-	{
-		.of_compatible = "dlg,da9055-regulator",
-		.name = "da9055-regulator",
-		.id = 7,
 		.resources = &da9055_ld05_6_resource,
 		.num_resources = 1,
+		.id = 6,
 	},
 	{
 		.of_compatible = "dlg,da9055-regulator",
 		.name = "da9055-regulator",
 		.resources = &da9055_ld05_6_resource,
 		.num_resources = 1,
-		.id = 8,
+		.id = 7,
 	},
 	{
 		.of_compatible = "dlg,da9055-onkey",
 		.name = "da9055-onkey",
 		.resources = &da9055_onkey_resource,
 		.num_resources = 1,
+		.id = -1,
 	},
 	{
 		.of_compatible = "dlg,da9055-rtc",
 		.name = "da9055-rtc",
 		.resources = da9055_rtc_resource,
 		.num_resources = ARRAY_SIZE(da9055_rtc_resource),
+		.id = -1,
 	},
 	{
 		.of_compatible = "dlg,da9055-hwmon",
 		.name = "da9055-hwmon",
 		.resources = &da9055_hwmon_resource,
 		.num_resources = 1,
+		.id = -1,
 	},
 	{
 		.of_compatible = "dlg,da9055-watchdog",
 		.name = "da9055-watchdog",
+		.id = -1,
 	},
 };
 
@@ -404,7 +409,7 @@ int da9055_device_init(struct da9055 *da9055)
 
 	da9055->irq_base = regmap_irq_chip_get_base(da9055->irq_data);
 
-	ret = mfd_add_devices(da9055->dev, -1,
+	ret = mfd_add_devices(da9055->dev, 0,
 			      da9055_devs, ARRAY_SIZE(da9055_devs),
 			      NULL, da9055->irq_base, NULL);
 	if (ret)
-- 
1.8.2.3

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