kernel: work_q: fix return value in non-error case

A recent patch allowed an error code to be returned even though the
execution path treated it as a non-error condition.  Clear the code
before returning.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-02-19 10:01:00 -06:00 committed by Johan Hedberg
parent f64cd1a5db
commit d8146d6c6d
1 changed files with 3 additions and 1 deletions

View File

@ -99,7 +99,9 @@ int k_delayed_work_submit_to_queue(struct k_work_q *work_q,
/* -EALREADY indicates the work has already completed so this
* is likely a recurring work.
*/
if (err < 0 && err != -EALREADY) {
if (err == -EALREADY) {
err = 0;
} else if (err < 0) {
goto done;
}
}