util/list: use helper function in list_is_singular

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8110>
This commit is contained in:
Marcin Ślusarz 2020-12-15 16:06:57 +01:00 committed by Marge Bot
parent a9bcb10ec4
commit 5f2166525f

View file

@ -124,7 +124,7 @@ static inline bool list_is_linked(const struct list_head *list)
*/
static inline bool list_is_singular(const struct list_head *list)
{
return list_is_linked(list) && list->next != list && list->next->next == list;
return list_is_linked(list) && !list_is_empty(list) && list->next->next == list;
}
static inline unsigned list_length(const struct list_head *list)