Skip to content

Commit e764374

Browse files
krzksre
authored andcommitted
power: supply: twl4030_charger: correct comparision with old current
Driver reads existing current value from two 8-bit registers, but then compares only one of them with the new 16-bit value. clang W=1 is also not happy: twl4030_charger.c:243:16: error: variable 'cur_reg' set but not used [-Werror,-Wunused-but-set-variable] Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sebastian Reichel <[email protected]>
1 parent a9125e8 commit e764374

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/power/supply/twl4030_charger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ static int twl4030_charger_update_current(struct twl4030_bci *bci)
363363
if (status < 0)
364364
return status;
365365
cur_reg |= oldreg << 8;
366-
if (reg != oldreg) {
366+
if (reg != cur_reg) {
367367
/* disable write protection for one write access for
368368
* BCIIREF */
369369
status = twl_i2c_write_u8(TWL_MODULE_MAIN_CHARGE, 0xE7,

0 commit comments

Comments
 (0)