public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: tps65090: Fix using wrong dev argument for calling of_regulator_match
@ 2013-01-30 12:28 Axel Lin
  2013-01-31  6:42 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2013-01-30 12:28 UTC (permalink / raw)
  To: Mark Brown; +Cc: Laxman Dewangan, Venu Byravarasu, 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/tps65090-regulator.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c
index 8687543..c8e7045 100644
--- a/drivers/regulator/tps65090-regulator.c
+++ b/drivers/regulator/tps65090-regulator.c
@@ -186,7 +186,7 @@ static struct tps65090_platform_data *tps65090_parse_dt_reg_data(
 		return ERR_PTR(-ENODEV);
 	}
 
-	ret = of_regulator_match(pdev->dev.parent, regulators, tps65090_matches,
+	ret = of_regulator_match(&pdev->dev, regulators, tps65090_matches,
 			ARRAY_SIZE(tps65090_matches));
 	if (ret < 0) {
 		dev_err(&pdev->dev,
-- 
1.7.9.5




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

* Re: [PATCH] regulator: tps65090: Fix using wrong dev argument for calling of_regulator_match
  2013-01-30 12:28 [PATCH] regulator: tps65090: Fix using wrong dev argument for calling of_regulator_match Axel Lin
@ 2013-01-31  6:42 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-01-31  6:42 UTC (permalink / raw)
  To: Axel Lin; +Cc: Laxman Dewangan, Venu Byravarasu, Liam Girdwood, linux-kernel

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

On Wed, Jan 30, 2013 at 08:28:20PM +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-31  6:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-30 12:28 [PATCH] regulator: tps65090: Fix using wrong dev argument for calling of_regulator_match Axel Lin
2013-01-31  6:42 ` Mark Brown

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