summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorHarry Yang <harryy@codeaurora.org>2016-12-14 16:02:47 -0800
committerHarry Yang <harryy@codeaurora.org>2017-01-04 22:59:39 -0800
commita154041d04c9e35eabab94ebae0895cc8d23f5d8 (patch)
treed26e604e8999aa8d0988579a1b216eabee9575bb /drivers/power
parentd9a8a3b2e153758557e462c843a897c305bd12a8 (diff)
qcom-charger: Fix crash due to null ptr access of pl psy
pl psy access is guarded by pl_disable_votable, disabled in PMI probe. Accessing parallel psy before it is available will cause crash. Fix this by allowing access to parallel psy only after all the initial votes have been cast on pl_disable_votable in probe. CRs-Fixed: 1101600 Change-Id: Idd289229f45c31cf8fd234339b6738bd241283bd Signed-off-by: Harry Yang <harryy@codeaurora.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/qcom-charger/qpnp-smb2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/power/qcom-charger/qpnp-smb2.c b/drivers/power/qcom-charger/qpnp-smb2.c
index cd137790ba42..a07325102631 100644
--- a/drivers/power/qcom-charger/qpnp-smb2.c
+++ b/drivers/power/qcom-charger/qpnp-smb2.c
@@ -1884,6 +1884,12 @@ static int smb2_probe(struct platform_device *pdev)
goto cleanup;
}
+ rc = smb2_init_hw(chip);
+ if (rc < 0) {
+ pr_err("Couldn't initialize hardware rc=%d\n", rc);
+ goto cleanup;
+ }
+
rc = smb2_init_dc_psy(chip);
if (rc < 0) {
pr_err("Couldn't initialize dc psy rc=%d\n", rc);
@@ -1916,12 +1922,6 @@ static int smb2_probe(struct platform_device *pdev)
goto cleanup;
}
- rc = smb2_init_hw(chip);
- if (rc < 0) {
- pr_err("Couldn't initialize hardware rc=%d\n", rc);
- goto cleanup;
- }
-
rc = smb2_determine_initial_status(chip);
if (rc < 0) {
pr_err("Couldn't determine initial status rc=%d\n",