diff options
author | Uwe Kleine-König <uwe@kleine-koenig.org> | 2016-05-11 03:11:23 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2016-05-29 19:37:11 -0400 |
commit | d68778b80dd78ad6ed998397af182163d0ef16b0 (patch) | |
tree | a3d4d8140133aec887dce8b3b9a9888ef2005c9b /drivers/rtc/interface.c | |
parent | 1a695a905c18548062509178b98bc91e67510864 (diff) |
rtc: initialize output parameter for read alarm to "uninitialized"
rtc drivers are supposed to set values they don't support to -1. To
simplify this for drivers and also make it harder for them to get it
wrong initialize the values to -1.
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc/interface.c')
-rw-r--r-- | drivers/rtc/interface.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 9ef5f6f89f98..99475908e556 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -104,7 +104,17 @@ static int rtc_read_alarm_internal(struct rtc_device *rtc, struct rtc_wkalrm *al | |||
104 | else if (!rtc->ops->read_alarm) | 104 | else if (!rtc->ops->read_alarm) |
105 | err = -EINVAL; | 105 | err = -EINVAL; |
106 | else { | 106 | else { |
107 | memset(alarm, 0, sizeof(struct rtc_wkalrm)); | 107 | alarm->enabled = 0; |
108 | alarm->pending = 0; | ||
109 | alarm->time.tm_sec = -1; | ||
110 | alarm->time.tm_min = -1; | ||
111 | alarm->time.tm_hour = -1; | ||
112 | alarm->time.tm_mday = -1; | ||
113 | alarm->time.tm_mon = -1; | ||
114 | alarm->time.tm_year = -1; | ||
115 | alarm->time.tm_wday = -1; | ||
116 | alarm->time.tm_yday = -1; | ||
117 | alarm->time.tm_isdst = -1; | ||
108 | err = rtc->ops->read_alarm(rtc->dev.parent, alarm); | 118 | err = rtc->ops->read_alarm(rtc->dev.parent, alarm); |
109 | } | 119 | } |
110 | 120 | ||