From c61519fd9abb1b520bcbe2eb21cf161d4d1b9eec Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 28 Aug 2014 21:04:49 +0800 Subject: 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. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- drivers/regulator/rk808-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c index f42952ead1bd..0d11df131eba 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; } -- cgit v1.2.3-58-ga151