rtc: pcf85063: return an error when date is invalid
Return an error when the date is invalid as the policy should be implemented there. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
This commit is contained in:
parent
b1f9d790b5
commit
5413eaba5a
1 changed files with 1 additions and 7 deletions
|
@ -80,13 +80,7 @@ static int pcf85063_get_datetime(struct i2c_client *client, struct rtc_time *tm)
|
||||||
pcf85063->c_polarity = (buf[PCF85063_REG_MO] & PCF85063_MO_C) ?
|
pcf85063->c_polarity = (buf[PCF85063_REG_MO] & PCF85063_MO_C) ?
|
||||||
(tm->tm_year >= 100) : (tm->tm_year < 100);
|
(tm->tm_year >= 100) : (tm->tm_year < 100);
|
||||||
|
|
||||||
/* the clock can give out invalid datetime, but we cannot return
|
return rtc_valid_tm(tm);
|
||||||
* -EINVAL otherwise hwclock will refuse to set the time on bootup.
|
|
||||||
*/
|
|
||||||
if (rtc_valid_tm(tm) < 0)
|
|
||||||
dev_err(&client->dev, "retrieved date/time is not valid.\n");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pcf85063_set_datetime(struct i2c_client *client, struct rtc_time *tm)
|
static int pcf85063_set_datetime(struct i2c_client *client, struct rtc_time *tm)
|
||||||
|
|
Loading…
Add table
Reference in a new issue