From f05ba07aaac9c86b904499f399d6168343d8cd39 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Fri, 1 May 2020 10:22:15 +0000 Subject: [PATCH] Fixed bug #1093. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/stable_20.3.x@13633 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/rt/src/chsem.c | 4 +--- readme.txt | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/os/rt/src/chsem.c b/os/rt/src/chsem.c index 1741dc929..e87de83ca 100644 --- a/os/rt/src/chsem.c +++ b/os/rt/src/chsem.c @@ -145,7 +145,6 @@ void chSemResetWithMessage(semaphore_t *sp, cnt_t n, msg_t msg) { * @iclass */ void chSemResetWithMessageI(semaphore_t *sp, cnt_t n, msg_t msg) { - cnt_t cnt; chDbgCheckClassI(); chDbgCheck((sp != NULL) && (n >= (cnt_t)0)); @@ -153,9 +152,8 @@ void chSemResetWithMessageI(semaphore_t *sp, cnt_t n, msg_t msg) { ((sp->cnt < (cnt_t)0) && queue_notempty(&sp->queue)), "inconsistent semaphore"); - cnt = sp->cnt; sp->cnt = n; - while (++cnt <= (cnt_t)0) { + while (queue_notempty(&sp->queue)) { chSchReadyI(queue_lifo_remove(&sp->queue))->u.rdymsg = msg; } } diff --git a/readme.txt b/readme.txt index c3a48a151..6607898de 100644 --- a/readme.txt +++ b/readme.txt @@ -73,6 +73,10 @@ *** Releases and Change Log *** ***************************************************************************** +*** 20.3.2 *** +- FIX: Fixed failure in chSemReset() function when counter is equal to MAXINT + (bug #1093). + *** 20.3.1 *** - NEW: STM32 ICU driver now allows to setup the ARR register in the configuration structure, the default value should be 0xFFFFFFFFU.