linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: tps6507x: Fix using wrong dev argument for calling of_regulator_match
@ 2013-01-27 12:54 Axel Lin
  2013-01-30 10:45 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2013-01-27 12:54 UTC (permalink / raw)
  To: Mark Brown
  Cc: Anuj Aggarwal, Vishwanathrao Badarkhe, Manish, Liam Girdwood,
	linux-kernel

The dev parameter is the device requesting the data.
In this case it should be &pdev->dev rather than pdev->dev.parent.

The dev parameter is used to call devm_kzalloc in of_get_regulator_init_data(),
which means this fixes a memory leak because the memory is allocated every time
probe() is called, thus it should be freed when this driver is unloaded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/tps6507x-regulator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index afdeb65..54aa2da 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -394,7 +394,7 @@ static struct tps6507x_board *tps6507x_parse_dt_reg_data(
 	count = ARRAY_SIZE(tps6507x_matches);
 	matches = tps6507x_matches;
 
-	ret = of_regulator_match(pdev->dev.parent, regulators, matches, count);
+	ret = of_regulator_match(&pdev->dev, regulators, matches, count);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Error parsing regulator init data: %d\n",
 			ret);
-- 
1.7.9.5




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

* Re: [PATCH] regulator: tps6507x: Fix using wrong dev argument for calling of_regulator_match
  2013-01-27 12:54 [PATCH] regulator: tps6507x: Fix using wrong dev argument for calling of_regulator_match Axel Lin
@ 2013-01-30 10:45 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-01-30 10:45 UTC (permalink / raw)
  To: Axel Lin
  Cc: Anuj Aggarwal, Vishwanathrao Badarkhe, Manish, Liam Girdwood,
	linux-kernel

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

On Sun, Jan 27, 2013 at 08:54:40PM +0800, Axel Lin wrote:
> The dev parameter is the device requesting the data.
> In this case it should be &pdev->dev rather than pdev->dev.parent.

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:[~2013-01-30 10:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-27 12:54 [PATCH] regulator: tps6507x: Fix using wrong dev argument for calling of_regulator_match Axel Lin
2013-01-30 10:45 ` 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).