[patch] rtc: ds3232: remove unneeded check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



bcd2bin() returns unsigned values so they're never less than zero.  I
asked Jack Lan and he said I could just remove that part of the check.

Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>

diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index 5706355..7767b4f 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -289,14 +289,10 @@ static void ds3232_update_alarm(struct i2c_client *client)
 	if (ret < 0)
 		goto unlock;
 
-	buf[0] = bcd2bin(buf[0]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ?
-								0x80 : buf[0];
-	buf[1] = bcd2bin(buf[1]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ?
-								0x80 : buf[1];
-	buf[2] = bcd2bin(buf[2]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ?
-								0x80 : buf[2];
-	buf[3] = bcd2bin(buf[3]) < 0 || (ds3232->rtc->irq_data & RTC_UF) ?
-								0x80 : buf[3];
+	buf[0] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[0];
+	buf[1] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[1];
+	buf[2] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[2];
+	buf[3] = (ds3232->rtc->irq_data & RTC_UF) ? 0x80 : buf[3];
 
 	ret = i2c_smbus_write_i2c_block_data(client, DS3232_REG_ALARM1, 4, buf);
 	if (ret < 0)
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux