From ee5ce58b8acc00ec096b2413a1572b37bb587465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=8F=E6=98=8E?= Date: Mon, 23 May 2022 16:15:26 +0800 Subject: [PATCH] IssuID:1626:Comparing an array to null is not useful "dp->vfs_dirent.d_name != NULL" since the test will always evaluate as true [Detail] Remove null check "dp->vfs_dirent.d_name != NULL" for "dp->vfs_dirent.d_name" is an array. [Verified Cases] Build Pass: Test Pass: --- components/ramfs/src/ramfs_vfs.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/components/ramfs/src/ramfs_vfs.c b/components/ramfs/src/ramfs_vfs.c index 99e46a10f6..574fc0839e 100644 --- a/components/ramfs/src/ramfs_vfs.c +++ b/components/ramfs/src/ramfs_vfs.c @@ -330,13 +330,9 @@ static vfs_dirent_t *ramfs_vfs_readdir(vfs_file_t *fp, vfs_dir_t *dir) int32_t res = -1; dp = fp->f_arg; - - if (dp->vfs_dirent.d_name != NULL) { - res = ramfs_readdir(&(dp->ramfs_dir), dp->vfs_dirent.d_name); - - if (res == 0) { - ret = &dp->vfs_dirent; - } + res = ramfs_readdir(&(dp->ramfs_dir), dp->vfs_dirent.d_name); + if (res == 0) { + ret = &dp->vfs_dirent; } return ret; -- GitLab