power: qpnp-smbcharger: fix out of boundary read on current table
The charger driver has a bug where it starts reading on
usb_current_table[ARRAY_SIZE(usb_current_table)] when trying to find the
correct usb current to use. This will read outside the array boundaries
and will give an incorrect value (most likely 0 because of how the
arrays are laid out).
The effects will most likely be setting a max usb current of 300mA
whenever a DCP or a CDP is plugged into the device.
Fix this by starting iteration on the correct value (array_size - 1).
Also, remove the extraneous call to calc_thermal_limited_current in the
smbchg_set_usb_current_max function. The callers of this function will
be the ones to limit the current based on thermal limits if necessary.
Change-Id: I41add7e79b444effa56632ec93b408bca876a85b
Signed-off-by:
Xiaozhe Shi <xiaozhes@codeaurora.org>
Loading
Please register or sign in to comment