Skip to content

Commit f45d32d

Browse files
bijudasalexandrebelloni
authored andcommitted
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 <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Biju Das <[email protected]> Reviewed-by: Pavel Machek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 45cc2a7 commit f45d32d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/rtc/rtc-isl1208.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ isl1208_i2c_validate_client(struct i2c_client *client)
188188
static int isl1208_set_xtoscb(struct i2c_client *client, int sr, int xtosb_val)
189189
{
190190
/* 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)
192192
return 0;
193193

194194
if (xtosb_val)
@@ -944,7 +944,6 @@ isl1208_probe(struct i2c_client *client)
944944
rc = isl1208_setup_irq(client, client->irq);
945945
if (rc)
946946
return rc;
947-
948947
} else {
949948
clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, isl1208->rtc->features);
950949
}

0 commit comments

Comments
 (0)