Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: isl1208: Fix incorrect logic in isl1208_set_xtoscb()

The XTOSCB bit is not bit 0, but xtosb_val is either 0 or 1. If it is 1,
test will never succeed. Fix this issue by using double negation.

While at it, remove unnecessary blank line from probe().

Reported-by: Pavel Machek <pavel@denx.de>
Closes: https://lore.kernel.org/all/ZN4BgzG2xmzOzdFZ@duo.ucw.cz/
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Pavel Machek <pavel@denx.de>
Link: https://lore.kernel.org/r/20230817161038.407960-1-biju.das.jz@bp.renesas.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Biju Das and committed by
Alexandre Belloni
f45d32d2 45cc2a7d

+1 -2
+1 -2
drivers/rtc/rtc-isl1208.c
··· 188 188 static int isl1208_set_xtoscb(struct i2c_client *client, int sr, int xtosb_val) 189 189 { 190 190 /* Do nothing if bit is already set to desired value */ 191 - if ((sr & ISL1208_REG_SR_XTOSCB) == xtosb_val) 191 + if (!!(sr & ISL1208_REG_SR_XTOSCB) == xtosb_val) 192 192 return 0; 193 193 194 194 if (xtosb_val) ··· 944 944 rc = isl1208_setup_irq(client, client->irq); 945 945 if (rc) 946 946 return rc; 947 - 948 947 } else { 949 948 clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, isl1208->rtc->features); 950 949 }