From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Gyungoh Yoo <jack.yoo@maxim-ic.com>,
Stephen Warren <swarren@nvidia.com>,
Laxman Dewangan <ldewangan@nvidia.com>,
Graeme Gregory <gg@slimlogic.co.uk>,
Liam Girdwood <lgirdwood@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] regulator: max8907: Fix using wrong dev argument for calling of_regulator_match
Date: Fri, 25 Jan 2013 10:20:29 +0800 [thread overview]
Message-ID: <1359080429.4232.3.camel@phoenix> (raw)
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/max8907-regulator.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c
index d1a7751..d40cf7f 100644
--- a/drivers/regulator/max8907-regulator.c
+++ b/drivers/regulator/max8907-regulator.c
@@ -237,8 +237,7 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev)
return -EINVAL;
}
- ret = of_regulator_match(pdev->dev.parent, regulators,
- max8907_matches,
+ ret = of_regulator_match(&pdev->dev, regulators, max8907_matches,
ARRAY_SIZE(max8907_matches));
if (ret < 0) {
dev_err(&pdev->dev, "Error parsing regulator init data: %d\n",
--
1.7.9.5
next reply other threads:[~2013-01-25 2:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 2:20 Axel Lin [this message]
2013-01-25 2:24 ` [PATCH 2/3] regulator: max77686: Fix using wrong dev argument at various places Axel Lin
2013-01-27 13:51 ` Yadwinder Singh Brar
2013-01-25 2:26 ` [PATCH 3/3] regulator: max8997: " Axel Lin
2013-01-25 4:55 ` [PATCH 1/3] regulator: max8907: Fix using wrong dev argument for calling of_regulator_match Stephen Warren
2013-01-27 2:57 ` Mark Brown
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=1359080429.4232.3.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=gg@slimlogic.co.uk \
--cc=jack.yoo@maxim-ic.com \
--cc=ldewangan@nvidia.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=swarren@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox