mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
smb5: modify error handing in smb5_parse_dt_mmi
kernel panic occurs in smb5_prob when the usb_dcp is not set in vhw.xml. modify error handing in smb5_parse_dt_mmi to avoid this case Change-Id: I12218ef1c067c5c23dd689c9fb88eb41ef8fa606 Signed-off-by: xuwt2 <xuwt2@lenovo.com> Reviewed-on: https://gerrit.mot.com/1681297 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Haijian Ma <mahj8@motorola.com> Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1771131
This commit is contained in:
parent
c34aae49b0
commit
e6d15ef2b3
1 changed files with 8 additions and 8 deletions
|
|
@ -763,8 +763,6 @@ static int smb5_parse_sdam(struct smb5 *chip, struct device_node *node)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define DCP_CURRENT_1500MA 1500000
|
||||
#define DCP_CURRENT_2000MA 2000000
|
||||
static int smb5_parse_dt_mmi(struct smb5 *chip, struct device_node *node)
|
||||
{
|
||||
struct smb_charger *chg = &chip->chg;
|
||||
|
|
@ -772,28 +770,30 @@ static int smb5_parse_dt_mmi(struct smb5 *chip, struct device_node *node)
|
|||
const char *dcp_curr = NULL;
|
||||
int retval;
|
||||
|
||||
chg->usb_dcp_curr_max = 0;
|
||||
np = of_find_node_by_path("/chosen");
|
||||
|
||||
if (!np)
|
||||
return -EINVAL;
|
||||
goto out;
|
||||
|
||||
retval = of_property_read_string(np, "mmi,usb_dcp",
|
||||
&dcp_curr);
|
||||
|
||||
if ((retval == -EINVAL) || !dcp_curr) {
|
||||
pr_err("mmi,usb_dcp unused\n");
|
||||
pr_info("mmi,usb_dcp unused\n");
|
||||
of_node_put(np);
|
||||
return -EINVAL;
|
||||
goto out;
|
||||
} else
|
||||
pr_err("usb_dcp = %s\n", dcp_curr);
|
||||
pr_info("usb_dcp = %s\n", dcp_curr);
|
||||
|
||||
if (strstr(dcp_curr, "1.5A"))
|
||||
chg->usb_dcp_curr_max = DCP_CURRENT_1500MA;
|
||||
chg->usb_dcp_curr_max = 1500000;
|
||||
else if (strstr(dcp_curr, "2A"))
|
||||
chg->usb_dcp_curr_max = DCP_CURRENT_2000MA;
|
||||
chg->usb_dcp_curr_max = 2000000;
|
||||
|
||||
of_node_put(np);
|
||||
|
||||
out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue