summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2016-04-10 17:59:23 +0300
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2016-05-20 13:33:51 +0300
commitbc83a141b8351f6d4458dd13eca5a66f2c0f3323 (patch)
treead1e38cf7b0ae2862847feb1ec7d5c215d6bc3b6
parent05a7f27a889f1635b7b7d5b051b17cacb25267fa (diff)
downloadlinux-bc83a141b8351f6d4458dd13eca5a66f2c0f3323.tar.xz
rtc: ds1302: fix error check in set_time
The set_time callback for rtc-ds1302 doesn't write clock registers because the error check for the return value from spi_write_then_read() is not correct. spi_write_then_read() which returns zero on success. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Sergey Yanovich <ynvich@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
-rw-r--r--drivers/rtc/rtc-ds1302.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-ds1302.c b/drivers/rtc/rtc-ds1302.c
index 7811b357ed70..283e653fa189 100644
--- a/drivers/rtc/rtc-ds1302.c
+++ b/drivers/rtc/rtc-ds1302.c
@@ -53,7 +53,7 @@ static int ds1302_rtc_set_time(struct device *dev, struct rtc_time *time)
status = spi_write_then_read(spi, buf, 2,
NULL, 0);
- if (!status)
+ if (status)
return status;
/* Write registers starting at the first time/date address. */