mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-02 20:35:32 +00:00
LIST_FOREACH() doesn't allow var to be removed or freed within the loop, but c_dev is freed inside the loop here. gcc 12 also reports error on it. This patch uses list_foreach_safe() macro instead for freeing var within the loop safely. Tracked-On: #8382 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
12 lines
271 B
C
12 lines
271 B
C
/*
|
|
* Copyright (C) 2023 Intel Corporation.
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <sys/queue.h>
|
|
|
|
#define list_foreach_safe(var, head, field, tvar) \
|
|
for ((var) = LIST_FIRST((head)); \
|
|
(var) && ((tvar) = LIST_NEXT((var), field), 1); \
|
|
(var) = (tvar))
|