All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: rk808: Fix memory leak
@ 2014-08-28 13:04 Axel Lin
  2014-08-28 15:01 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2014-08-28 13:04 UTC (permalink / raw)
  To: Mark Brown
  Cc: Chris Zhong, Zhang Qing, Liam Girdwood,
	linux-kernel@vger.kernel.org

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




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

end of thread, other threads:[~2014-08-28 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-28 13:04 [PATCH] regulator: rk808: Fix memory leak Axel Lin
2014-08-28 15:01 ` Mark Brown

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.