Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ce8217d authored by Anirudh Ghayal's avatar Anirudh Ghayal
Browse files

power: fg-util: Fix the address mask for secure_write check



For the 16-bit FG peripheral register address check the lower-byte
for secure_access instead of the upper-byte.

CRs-Fixed: 2013922
Change-Id: I647aa4eadccb007e6e974eae65cef162c5a40a0d
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent 81eef00c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -358,7 +358,7 @@ int fg_write(struct fg_chip *chip, int addr, u8 *val, int len)
		return -ENXIO;

	mutex_lock(&chip->bus_lock);
	sec_access = (addr & 0xFF00) > 0xD0;
	sec_access = (addr & 0x00FF) > 0xD0;
	if (sec_access) {
		rc = regmap_write(chip->regmap, (addr & 0xFF00) | 0xD0, 0xA5);
		if (rc < 0) {
@@ -398,7 +398,7 @@ int fg_masked_write(struct fg_chip *chip, int addr, u8 mask, u8 val)
		return -ENXIO;

	mutex_lock(&chip->bus_lock);
	sec_access = (addr & 0xFF00) > 0xD0;
	sec_access = (addr & 0x00FF) > 0xD0;
	if (sec_access) {
		rc = regmap_write(chip->regmap, (addr & 0xFF00) | 0xD0, 0xA5);
		if (rc < 0) {