Skip to content

Commit 4fd9ac6

Browse files
dinghaoliuandy-shev
authored andcommitted
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: 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>
1 parent 9123e3a commit 4fd9ac6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/platform/olpc/olpc-ec.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,9 @@ static int olpc_ec_probe(struct platform_device *pdev)
439439
&config);
440440
if (IS_ERR(ec->dcon_rdev)) {
441441
dev_err(&pdev->dev, "failed to register DCON regulator\n");
442-
return PTR_ERR(ec->dcon_rdev);
442+
err = PTR_ERR(ec->dcon_rdev);
443+
kfree(ec);
444+
return err;
443445
}
444446

445447
ec->dbgfs_dir = olpc_ec_setup_debugfs();

0 commit comments

Comments
 (0)