Merge tag 'topic/drm-misc-2016-06-01' of git://anongit.freedesktop.org/drm-intel...
[cascardo/linux.git] / drivers / rtc / rtc-ds1302.c
index 7811b35..f5dd09f 100644 (file)
@@ -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. */
@@ -65,7 +65,7 @@ static int ds1302_rtc_set_time(struct device *dev, struct rtc_time *time)
        *bp++ = bin2bcd(time->tm_hour);
        *bp++ = bin2bcd(time->tm_mday);
        *bp++ = bin2bcd(time->tm_mon + 1);
-       *bp++ = time->tm_wday;
+       *bp++ = time->tm_wday + 1;
        *bp++ = bin2bcd(time->tm_year % 100);
        *bp++ = RTC_CMD_WRITE_DISABLE;