summaryrefslogtreecommitdiffstats
path: root/drivers/platform/olpc
diff options
context:
space:
mode:
authorDinghao Liu <dinghao.liu@zju.edu.cn>2020-08-23 13:12:11 +0200
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2020-09-24 11:40:30 +0200
commit4fd9ac6bd3044734a7028bd993944c3617d1eede (patch)
treef930ad3d1ca380ed13193aee4b3d30a728249ba4 /drivers/platform/olpc
parentLinux 5.9-rc1 (diff)
downloadlinux-4fd9ac6bd3044734a7028bd993944c3617d1eede.tar.xz
linux-4fd9ac6bd3044734a7028bd993944c3617d1eede.zip
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: 231c0c216172a ("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>
Diffstat (limited to 'drivers/platform/olpc')
-rw-r--r--drivers/platform/olpc/olpc-ec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c
index 190e4a6186ef..f64b82824db2 100644
--- a/drivers/platform/olpc/olpc-ec.c
+++ b/drivers/platform/olpc/olpc-ec.c
@@ -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();