From 2a53883af96a6467ce1ff6d450832447c777589f Mon Sep 17 00:00:00 2001 From: yidong0635 Date: Thu, 22 Oct 2020 11:35:17 -0400 Subject: [PATCH] env_dpdk/memory: Fix warning of scanbuild. We can verify readdir(dir) directly. And this fixes issue : memory.c:1233:23: warning: Although the value stored to 'd' is used in the enclosing expression, the value is never actually read from 'd' while (count < 3 && (d = readdir(dir)) != NULL) { ^ ~~~~~~~~~~~~ Signed-off-by: yidong0635 Change-Id: I34b191c9f89d8ae67697ec8e331f9c7c78c16ab2 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4819 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: John Kariuki Reviewed-by: Paul Luse Reviewed-by: Aleksey Marchuk Reviewed-by: Tomasz Zawadzki Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris --- lib/env_dpdk/memory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/env_dpdk/memory.c b/lib/env_dpdk/memory.c index 8670c30ec..22c202c93 100644 --- a/lib/env_dpdk/memory.c +++ b/lib/env_dpdk/memory.c @@ -1222,7 +1222,6 @@ vfio_enabled(void) static bool has_iommu_groups(void) { - struct dirent *d; int count = 0; DIR *dir = opendir("/sys/kernel/iommu_groups"); @@ -1230,7 +1229,7 @@ has_iommu_groups(void) return false; } - while (count < 3 && (d = readdir(dir)) != NULL) { + while (count < 3 && readdir(dir) != NULL) { count++; }