public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: palmas: fix pdata ptr not be updated after it has been allocated
@ 2013-07-24 16:28 Rhyland Klein
  2013-07-24 17:02 ` Mark Brown
  2013-07-24 17:20 ` Stephen Warren
  0 siblings, 2 replies; 4+ messages in thread
From: Rhyland Klein @ 2013-07-24 16:28 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: Joseph Lo, linux-kernel, linux-tegra, Rhyland Klein

The pmic platform data wasn't updated to dev.platform_data after it had
been allocated. That can cause the driver crash when using it.
This patch fixes the issue.

We need to update the pdata pointer at the end of probe because if
probe should fail for some reason, for instance if an in-supply
isn't ready yet, then probe will defer. However, the pdata is allocated
with devm, and so is freed when probe is deferred.

Based on work by Joseph Lo.

Cc: Joseph Lo <josephl@nvidia.com>
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
---
 drivers/regulator/palmas-regulator.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index d0c8785..e11b762 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -1027,6 +1027,8 @@ static int palmas_regulators_probe(struct platform_device *pdev)
 		}
 	}
 
+	/* Store the pdata pointer after everything else passes */
+	pdev->dev.platform_data = pdata;
 
 	return 0;
 
-- 
1.7.9.5


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

end of thread, other threads:[~2013-07-24 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-24 16:28 [PATCH] regulator: palmas: fix pdata ptr not be updated after it has been allocated Rhyland Klein
2013-07-24 17:02 ` Mark Brown
2013-07-24 17:09   ` Rhyland Klein
2013-07-24 17:20 ` Stephen Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox