Skip to content

Commit

Permalink
Platform: OLPC: Fix probe error handling
Browse files Browse the repository at this point in the history
[ Upstream commit cec551e ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
lkundrak authored and gregkh committed Mar 17, 2021
1 parent 09ef146 commit 711112e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions drivers/platform/olpc/olpc-ec.c
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit 711112e

Please sign in to comment.