All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris BREZILLON <boris.brezillon@free-electrons.com>
To: Samuel Ortiz <sameo@linux.intel.com>,
	Lee Jones <lee.jones@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>,
	Carlo Caione <carlo@caione.org>, Shuge <shuge@allwinnertech.com>,
	kevin@allwinnertech.com, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, dev@linux-sunxi.org,
	Boris BREZILLON <boris.brezillon@free-electrons.com>
Subject: [PATCH v3 4/6] regulator: axp20x: reset probe data before each probe
Date: Tue, 27 May 2014 11:38:53 +0200	[thread overview]
Message-ID: <1401183535-31003-5-git-send-email-boris.brezillon@free-electrons.com> (raw)
In-Reply-To: <1401183535-31003-1-git-send-email-boris.brezillon@free-electrons.com>

The init_data and of_node fields of the axp2xx_matches tables are filled
at each device probe by the axp20x_regulator_parse_dt function (which then
calls the of_regulator_match function).
This means we can probe a new device and consider data initialized during
the probe of another device as valid.

Reset init_data and of_node field to NULL before each probe in order to
avoid this kind of issue.

Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
---
 drivers/regulator/axp20x-regulator.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index feaa0b5..4486517 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -323,6 +323,15 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		nregulators = AXP20X_REG_ID_MAX;
 	}
 
+	/*
+	 * Reset matches table (this table might have been modified by a
+	 * previous AXP2xx device probe).
+	 */
+	for (i = 0; i < nmatches; i++) {
+		matches[i].init_data = NULL;
+		matches[i].of_node = NULL;
+	}
+
 	ret = axp20x_regulator_parse_dt(pdev, matches, nmatches);
 	if (ret)
 		return ret;
-- 
1.8.3.2


WARNING: multiple messages have this Message-ID (diff)
From: boris.brezillon@free-electrons.com (Boris BREZILLON)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 4/6] regulator: axp20x: reset probe data before each probe
Date: Tue, 27 May 2014 11:38:53 +0200	[thread overview]
Message-ID: <1401183535-31003-5-git-send-email-boris.brezillon@free-electrons.com> (raw)
In-Reply-To: <1401183535-31003-1-git-send-email-boris.brezillon@free-electrons.com>

The init_data and of_node fields of the axp2xx_matches tables are filled
at each device probe by the axp20x_regulator_parse_dt function (which then
calls the of_regulator_match function).
This means we can probe a new device and consider data initialized during
the probe of another device as valid.

Reset init_data and of_node field to NULL before each probe in order to
avoid this kind of issue.

Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
---
 drivers/regulator/axp20x-regulator.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index feaa0b5..4486517 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -323,6 +323,15 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
 		nregulators = AXP20X_REG_ID_MAX;
 	}
 
+	/*
+	 * Reset matches table (this table might have been modified by a
+	 * previous AXP2xx device probe).
+	 */
+	for (i = 0; i < nmatches; i++) {
+		matches[i].init_data = NULL;
+		matches[i].of_node = NULL;
+	}
+
 	ret = axp20x_regulator_parse_dt(pdev, matches, nmatches);
 	if (ret)
 		return ret;
-- 
1.8.3.2

  parent reply	other threads:[~2014-05-27  9:40 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27  9:38 [PATCH v3 0/6] mfd: axp20x: add AXP221 PMIC support Boris BREZILLON
2014-05-27  9:38 ` Boris BREZILLON
2014-05-27  9:38 ` [PATCH v3 1/6] " Boris BREZILLON
2014-05-27  9:38   ` Boris BREZILLON
2014-05-27 10:05   ` Lee Jones
2014-05-27 10:05     ` Lee Jones
2014-05-27 10:14     ` Boris BREZILLON
2014-05-27 10:14       ` Boris BREZILLON
2014-05-27  9:38 ` [PATCH v3 2/6] regulator: axp20x: prepare support for multiple AXP chip families Boris BREZILLON
2014-05-27  9:38   ` Boris BREZILLON
2014-05-27  9:38 ` [PATCH v3 3/6] regulator: axp20x: add support for AXP221 regulators Boris BREZILLON
2014-05-27  9:38   ` Boris BREZILLON
2014-05-27  9:38 ` Boris BREZILLON [this message]
2014-05-27  9:38   ` [PATCH v3 4/6] regulator: axp20x: reset probe data before each probe Boris BREZILLON
2014-05-27  9:38 ` [PATCH v3 5/6] regulator: add support for regulator set registration Boris BREZILLON
2014-05-27  9:38   ` Boris BREZILLON
2014-06-10 13:40   ` Boris BREZILLON
2014-06-10 13:40     ` Boris BREZILLON
2014-06-16  8:08     ` Lee Jones
2014-06-16  8:08       ` Lee Jones
2014-06-16 13:24       ` Boris BREZILLON
2014-06-16 13:24         ` Boris BREZILLON
2014-05-27  9:38 ` [PATCH v3 6/6] regulator: axp20x: make use of devm_regulator_set_register Boris BREZILLON
2014-05-27  9:38   ` Boris BREZILLON
2014-05-27 19:49 ` [PATCH v3 0/6] mfd: axp20x: add AXP221 PMIC support Mark Brown
2014-05-27 19:49   ` Mark Brown
     [not found]   ` <9ed19670-7a2e-4324-a201-6d3c8514bdb3@googlegroups.com>
2014-05-28 17:49     ` Mark Brown
2014-05-28 17:49       ` Mark Brown
2014-05-28 19:46   ` Boris BREZILLON
2014-05-28 19:46     ` Boris BREZILLON

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401183535-31003-5-git-send-email-boris.brezillon@free-electrons.com \
    --to=boris.brezillon@free-electrons.com \
    --cc=broonie@kernel.org \
    --cc=carlo@caione.org \
    --cc=dev@linux-sunxi.org \
    --cc=kevin@allwinnertech.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=sameo@linux.intel.com \
    --cc=shuge@allwinnertech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.