diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2021-01-26 08:37:38 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2021-02-02 20:51:18 +0100 |
commit | cec551ea0d41c679ed11d758e1a386e20285b29d (patch) | |
tree | fe9981a100a03a09b7fe74fd49c636db1e5bef53 /drivers | |
parent | 745ed17a04f966406c8c27c8f992544336c06013 (diff) | |
download | linux-cec551ea0d41c679ed11d758e1a386e20285b29d.tar.gz linux-cec551ea0d41c679ed11d758e1a386e20285b29d.tar.bz2 linux-cec551ea0d41c679ed11d758e1a386e20285b29d.zip |
Platform: OLPC: Fix probe error handling
Reset ec_priv if probe ends unsuccessfully.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20210126073740.10232-2-lkundrak@v3.sk
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/platform/olpc/olpc-ec.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c index f64b82824db2..2db7113383fd 100644 --- a/drivers/platform/olpc/olpc-ec.c +++ b/drivers/platform/olpc/olpc-ec.c @@ -426,11 +426,8 @@ static int olpc_ec_probe(struct platform_device *pdev) /* get the EC revision */ err = olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0, &ec->version, 1); - if (err) { - ec_priv = NULL; - kfree(ec); - return err; - } + if (err) + goto error; config.dev = pdev->dev.parent; config.driver_data = ec; @@ -440,12 +437,16 @@ static int olpc_ec_probe(struct platform_device *pdev) if (IS_ERR(ec->dcon_rdev)) { dev_err(&pdev->dev, "failed to register DCON regulator\n"); err = PTR_ERR(ec->dcon_rdev); - kfree(ec); - return err; + goto error; } ec->dbgfs_dir = olpc_ec_setup_debugfs(); + return 0; + +error: + ec_priv = NULL; + kfree(ec); return err; } |