linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: s2mps11: Fix NULL pointer of_node value when using platform data
@ 2014-01-30 13:51 Krzysztof Kozlowski
  2014-01-31 16:53 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2014-01-30 13:51 UTC (permalink / raw)
  To: Sangbeom Kim, Liam Girdwood, Mark Brown, linux-kernel; +Cc: Krzysztof Kozlowski

When platform_data is used for regulator (of_node of sec-core MFD device
is NULL) the config.of_node for regulator is not initialized. This NULL
value of config.of_node is later stored during regulator_register().
Thus any call by regulator consumers to of_get_regulator() will fail on
of_parse_phandle() returning NULL.

In this case (using platform_data and parent's driver of_node is NULL)
set the config.of_node to reg_node from platform_data.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/regulator/s2mps11.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index d9e557990577..cd0b9e35a56d 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -441,6 +441,7 @@ common_reg:
 	for (i = 0; i < S2MPS11_REGULATOR_MAX; i++) {
 		if (!reg_np) {
 			config.init_data = pdata->regulators[i].initdata;
+			config.of_node = pdata->regulators[i].reg_node;
 		} else {
 			config.init_data = rdata[i].init_data;
 			config.of_node = rdata[i].of_node;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: s2mps11: Fix NULL pointer of_node value when using platform data
  2014-01-30 13:51 [PATCH] regulator: s2mps11: Fix NULL pointer of_node value when using platform data Krzysztof Kozlowski
@ 2014-01-31 16:53 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-01-31 16:53 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Sangbeom Kim, Liam Girdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

On Thu, Jan 30, 2014 at 02:51:19PM +0100, Krzysztof Kozlowski wrote:
> When platform_data is used for regulator (of_node of sec-core MFD device
> is NULL) the config.of_node for regulator is not initialized. This NULL
> value of config.of_node is later stored during regulator_register().
> Thus any call by regulator consumers to of_get_regulator() will fail on
> of_parse_phandle() returning NULL.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-31 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-30 13:51 [PATCH] regulator: s2mps11: Fix NULL pointer of_node value when using platform data Krzysztof Kozlowski
2014-01-31 16:53 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).