Merge tag 'rtc-4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux

Pull RTC fixes from Alexandre Belloni:
"Two fixes for 4.18:

- an important core fix for RTCs using the core offsetting only one
driver is affected

- a fix for the error path of mrst"

* tag 'rtc-4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux:
rtc: fix alarm read and set offset
rtc: mrst: fix error code in probe()

Changed files
+6 -6
drivers
+5 -3
drivers/rtc/interface.c
··· 265 265 return err; 266 266 267 267 /* full-function RTCs won't have such missing fields */ 268 - if (rtc_valid_tm(&alarm->time) == 0) 268 + if (rtc_valid_tm(&alarm->time) == 0) { 269 + rtc_add_offset(rtc, &alarm->time); 269 270 return 0; 271 + } 270 272 271 273 /* get the "after" timestamp, to detect wrapped fields */ 272 274 err = rtc_read_time(rtc, &now); ··· 411 409 if (err) 412 410 return err; 413 411 414 - rtc_subtract_offset(rtc, &alarm->time); 415 412 scheduled = rtc_tm_to_time64(&alarm->time); 416 413 417 414 /* Make sure we're not setting alarms in the past */ ··· 426 425 * the is alarm set for the next second and the second ticks 427 426 * over right here, before we set the alarm. 428 427 */ 428 + 429 + rtc_subtract_offset(rtc, &alarm->time); 429 430 430 431 if (!rtc->ops) 431 432 err = -ENODEV; ··· 470 467 471 468 mutex_unlock(&rtc->ops_lock); 472 469 473 - rtc_add_offset(rtc, &alarm->time); 474 470 return err; 475 471 } 476 472 EXPORT_SYMBOL_GPL(rtc_set_alarm);
+1 -3
drivers/rtc/rtc-mrst.c
··· 367 367 } 368 368 369 369 retval = rtc_register_device(mrst_rtc.rtc); 370 - if (retval) { 371 - retval = PTR_ERR(mrst_rtc.rtc); 370 + if (retval) 372 371 goto cleanup0; 373 - } 374 372 375 373 dev_dbg(dev, "initialised\n"); 376 374 return 0;