]> git.karo-electronics.de Git - linux-beck.git/commitdiff
regulator: rk808: Fix memory leak
authorAxel Lin <axel.lin@ingics.com>
Thu, 28 Aug 2014 13:04:49 +0000 (21:04 +0800)
committerMark Brown <broonie@linaro.org>
Thu, 28 Aug 2014 15:01:25 +0000 (16:01 +0100)
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>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/rk808-regulator.c

index f42952ead1bda1fe8bb7049bf76c792ea0d0e83c..0d11df131ebac4638ce6892555b5d635d486dd2e 100644 (file)
@@ -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;
        }