qcom-charger: smb-lib: fix secure register writes

Currently the entire address is compared to a known secure boundary
offset leading to the address always being larger than the offset.
Mask the address such that only the offsets are compared.

Change-Id: I388d7f809f670c6db45b933d44d15168ae84f061
Signed-off-by: Nicholas Troast <ntroast@codeaurora.org>
This commit is contained in:
Nicholas Troast 2016-07-18 13:40:25 -07:00
parent 8665552e83
commit adb003dad0

View file

@ -30,7 +30,7 @@
static bool is_secure(struct smb_charger *chg, int addr)
{
/* assume everything above 0xC0 is secure */
return (bool)(addr >= 0xC0);
return (bool)((addr & 0xFF) >= 0xC0);
}
int smblib_read(struct smb_charger *chg, u16 addr, u8 *val)