Skip to content

Commit

Permalink
Platform: OLPC: Fix memleak in olpc_ec_probe
Browse files Browse the repository at this point in the history
When devm_regulator_register() fails, ec should be
freed just like when olpc_ec_cmd() fails.

Fixes: 231c0c2 ("Platform: OLPC: Add a regulator for the DCON")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
Dinghao Liu authored and Andy Shevchenko committed Sep 24, 2020
1 parent 9123e3a commit 4fd9ac6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/platform/olpc/olpc-ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,9 @@ static int olpc_ec_probe(struct platform_device *pdev)
&config);
if (IS_ERR(ec->dcon_rdev)) {
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();
Expand Down

0 comments on commit 4fd9ac6

Please sign in to comment.