regulator: rk808: Fix memory leak
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.
Signed-off-by Axel Lin <[email protected]>
--- drivers/regulator/rk808-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/rk808-regulator.c +1 -1
@@ -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
Quoted 3 lines · Axel Lin
The memory allocated in
rk808_regulator_probe()needs to be freed when the module is unloaded. Thus pass&pdev->devrather than&client->devtodevm_kzalloc.
Applied, thanks.