From 3c53b2c573a14c3c191137ed374c9dc97dffdda6 Mon Sep 17 00:00:00 2001 From: vsfos Date: Tue, 8 Aug 2023 23:35:19 +0800 Subject: [PATCH] [component/fs/romfs] minor tweak --- source/component/fs/driver/romfs/vsf_romfs.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/source/component/fs/driver/romfs/vsf_romfs.c b/source/component/fs/driver/romfs/vsf_romfs.c index e271f297f..f7cf1f24a 100644 --- a/source/component/fs/driver/romfs/vsf_romfs.c +++ b/source/component/fs/driver/romfs/vsf_romfs.c @@ -154,14 +154,10 @@ static bool __vsf_romfs_should_hide(vk_romfs_header_t *image_head, vk_romfs_head vk_romfs_header_t *header; while (image_head != image_cur) { header = __vsf_romfs_lookup_in_image(image_head, dir); - image_head = (vk_romfs_header_t *)((uint8_t *)image_head + be32_to_cpu(image_head->size)); - if (NULL == header) { - continue; - } - - if (__vsf_romfs_lookup_in_dir(image_head, header, name) != NULL) { + if ((header != NULL) && (__vsf_romfs_lookup_in_dir(image_head, header, name) != NULL)) { return true; } + image_head = (vk_romfs_header_t *)((uint8_t *)image_head + be32_to_cpu(image_head->size)); } return false; } @@ -276,13 +272,10 @@ __vsf_component_peda_ifs_entry(__vk_romfs_lookup, vk_file_lookup) if (!dir->level) { header = image + 1; - } else { - header = __vsf_romfs_lookup_in_image(image, dir); - if (header != NULL) { - header++; - } + } else if ((header = __vsf_romfs_lookup_in_image(image, dir)) != NULL) { + header++; } - if(header != NULL) { + if (header != NULL) { goto lookup_next_image; } }