diff mbox series

mtd-interface: replace LIST_FOREACH with LIST_FOREACH_SAFE

Message ID 20200405094442.10068-1-sbabic@denx.de
State Accepted
Headers show
Series mtd-interface: replace LIST_FOREACH with LIST_FOREACH_SAFE | expand

Commit Message

Stefano Babic April 5, 2020, 9:44 a.m. UTC
Fix coverity #292200

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 corelib/mtd-interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/corelib/mtd-interface.c b/corelib/mtd-interface.c
index ccbe178..9a193d9 100644
--- a/corelib/mtd-interface.c
+++ b/corelib/mtd-interface.c
@@ -511,13 +511,13 @@  void mtd_cleanup (void)
 {
 	int i;
 	struct ubilist *list;
-	struct ubi_part *vol;
+	struct ubi_part *vol, *tmp;
 	struct flash_description *flash = get_flash_info();
 
 	if (flash->mtd_info) {
 		for (i = flash->mtd.lowest_mtd_num; i <= flash->mtd.highest_mtd_num; i++) {
 			list = &flash->mtd_info[i].ubi_partitions;
-			LIST_FOREACH(vol, list, next) {
+			LIST_FOREACH_SAFE(vol, list, next, tmp) {
 				LIST_REMOVE(vol, next);
 				free(vol);
 			}