Commit 4fd9ac6b authored by Dinghao Liu's avatar Dinghao Liu Committed by Andy Shevchenko

Platform: OLPC: Fix memleak in olpc_ec_probe

When devm_regulator_register() fails, ec should be
freed just like when olpc_ec_cmd() fails.

Fixes: 231c0c21 ("Platform: OLPC: Add a regulator for the DCON")
Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 9123e3a7
...@@ -439,7 +439,9 @@ static int olpc_ec_probe(struct platform_device *pdev) ...@@ -439,7 +439,9 @@ static int olpc_ec_probe(struct platform_device *pdev)
&config); &config);
if (IS_ERR(ec->dcon_rdev)) { if (IS_ERR(ec->dcon_rdev)) {
dev_err(&pdev->dev, "failed to register DCON regulator\n"); dev_err(&pdev->dev, "failed to register DCON regulator\n");
return PTR_ERR(ec->dcon_rdev); err = PTR_ERR(ec->dcon_rdev);
kfree(ec);
return err;
} }
ec->dbgfs_dir = olpc_ec_setup_debugfs(); ec->dbgfs_dir = olpc_ec_setup_debugfs();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment