Commit cec551ea authored by Lubomir Rintel's avatar Lubomir Rintel Committed by Hans de Goede

Platform: OLPC: Fix probe error handling

Reset ec_priv if probe ends unsuccessfully.
Signed-off-by: default avatarLubomir Rintel <lkundrak@v3.sk>
Link: https://lore.kernel.org/r/20210126073740.10232-2-lkundrak@v3.skReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 745ed17a
...@@ -426,11 +426,8 @@ static int olpc_ec_probe(struct platform_device *pdev) ...@@ -426,11 +426,8 @@ static int olpc_ec_probe(struct platform_device *pdev)
/* get the EC revision */ /* get the EC revision */
err = olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0, &ec->version, 1); err = olpc_ec_cmd(EC_FIRMWARE_REV, NULL, 0, &ec->version, 1);
if (err) { if (err)
ec_priv = NULL; goto error;
kfree(ec);
return err;
}
config.dev = pdev->dev.parent; config.dev = pdev->dev.parent;
config.driver_data = ec; config.driver_data = ec;
...@@ -440,12 +437,16 @@ static int olpc_ec_probe(struct platform_device *pdev) ...@@ -440,12 +437,16 @@ static int olpc_ec_probe(struct platform_device *pdev)
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");
err = PTR_ERR(ec->dcon_rdev); err = PTR_ERR(ec->dcon_rdev);
kfree(ec); goto error;
return err;
} }
ec->dbgfs_dir = olpc_ec_setup_debugfs(); ec->dbgfs_dir = olpc_ec_setup_debugfs();
return 0;
error:
ec_priv = NULL;
kfree(ec);
return err; return err;
} }
......
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