From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: Chris Zhong <zyw@rock-chips.com>,
Zhang Qing <zhanqging@rock-chips.com>,
Liam Girdwood <lgirdwood@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] regulator: rk808: Fix memory leak
Date: Thu, 28 Aug 2014 21:04:49 +0800 [thread overview]
Message-ID: <1409231089.10292.0.camel@phoenix> (raw)
The memory allocated in rk808_regulator_probe() needs to be freed when the
module is unloaded. Thus pass &pdev->dev rather than &client->dev to
devm_kzalloc.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/rk808-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index f42952e..0d11df1 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -342,7 +342,7 @@ static int rk808_regulator_probe(struct platform_device *pdev)
int ret = 0;
if (!pdata) {
- pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
+ pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return -ENOMEM;
}
--
1.9.1
next reply other threads:[~2014-08-28 13:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-28 13:04 Axel Lin [this message]
2014-08-28 15:01 ` [PATCH] regulator: rk808: Fix memory leak 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=1409231089.10292.0.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zhanqging@rock-chips.com \
--cc=zyw@rock-chips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.