mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
Platform: OLPC: Fix probe error handling
[ Upstream commit cec551ea0d
]
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>
This commit is contained in:
parent
ccad3c70fc
commit
26d60799d9
1 changed files with 8 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue