diff options
author | Frank Kühndel <frank.kuehndel@embedded-brains.de> | 2021-05-11 16:26:55 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-05-12 06:41:10 +0200 |
commit | 3af2dc7802164d6c22dbef1f144c9bd945a35c30 (patch) | |
tree | 6c34fd16da24213f89fde232dd6a0f7ccf87cf35 /bsps/arm/altera-cyclone-v/rtc/rtc.c | |
parent | rtems: Use _Objects_Free_nothing() for msg queues (diff) | |
download | rtems-3af2dc7802164d6c22dbef1f144c9bd945a35c30.tar.bz2 |
_TOD_Validate(): Fix incorrect return code
This patch fixes bug #4403. Directives
* rtems_timer_fire_when()
* rtems_timer_server_fire_when()
* rtems_task_wake_when()
are documented to return RTEMS_INVALID_ADDRESS when their time-of-day
argument is NULL. But actually they return RTEMS_INVALID_CLOCK. To fix
the issue this patch changes _TOD_Validate() to return a
status code instead of just true/false.
Close #4403
Diffstat (limited to 'bsps/arm/altera-cyclone-v/rtc/rtc.c')
-rw-r--r-- | bsps/arm/altera-cyclone-v/rtc/rtc.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/bsps/arm/altera-cyclone-v/rtc/rtc.c b/bsps/arm/altera-cyclone-v/rtc/rtc.c index 3e8c68e789..fb30da8d66 100644 --- a/bsps/arm/altera-cyclone-v/rtc/rtc.c +++ b/bsps/arm/altera-cyclone-v/rtc/rtc.c @@ -353,10 +353,9 @@ static int altera_cyclone_v_ds1339_get_time(int minor, rtems_time_of_day* tod) temp_tod.month = ds1339_get_month(&time); temp_tod.year = ds1339_get_year(&time); - if (_TOD_Validate(&temp_tod)) + sc = _TOD_Validate(&temp_tod) + if (sc == RTEMS_SUCCESSFUL) memcpy(tod, &temp_tod, sizeof(temp_tod)); - else - sc = RTEMS_INVALID_CLOCK; } return -sc; @@ -737,10 +736,9 @@ static int altera_cyclone_v_m41st87_get_time(int minor, rtems_time_of_day* tod) temp_tod.month = m41st87_get_month(&time); temp_tod.year = m41st87_get_year(&time); - if (_TOD_Validate(&temp_tod)) + sc = _TOD_Validate(&temp_tod); + if (sc == RTEMS_SUCCESSFUL) memcpy(tod, &temp_tod, sizeof(temp_tod)); - else - sc = RTEMS_INVALID_CLOCK; return -sc; } |