From bc83a141b8351f6d4458dd13eca5a66f2c0f3323 Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Sun, 10 Apr 2016 23:59:23 +0900 Subject: 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 Cc: Sergey Yanovich Cc: Alessandro Zummo Cc: Alexandre Belloni Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-ds1302.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/rtc/rtc-ds1302.c') 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. */ -- cgit