Skip to contentSkip to conversation

regulator: rk808: Fix memory leak

PATCH Applied Axel Lin 2 participants 2 messages Aug 28, 2014 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: rk808: Fix memory leak

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.

---
 drivers/regulator/rk808-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/rk808-regulator.c +1 -1
index f42952e..0d11df1 100644
@@ -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;
 	}
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw
Quoted 3 lines · Axel Lin

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.

Applied, thanks.