Skip to content
Commit 602295a8 authored by Benjamin Walsh's avatar Benjamin Walsh Committed by Anas Nashif
Browse files

dlist: fix SYS_DLIST_FOR_EACH_SAFE when operating on empty list



There was no check to see if the head of a list was empty before trying
to fetch the next node in the list. The fix is added to
sys_dlist_peek_next() so that it also return NULL if the node parameter
is NULL, in addition to being the tail of the list.

Since the value is not used until the second iteration of the loop, and
there will be no second iteration if the list is empty, as long as the
CPU does allow reading at address 0, this was not causing any issues.

Our ARC targets did not seem to like that.

Fixes ZEP-1263 and ZEP-1297.

Change-Id: I07ca16592d206d13662226d1249f487ee78c06aa
Signed-off-by: default avatarBenjamin Walsh <walsh.benj@gmail.com>
parent 829c3ceb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment