From: Karel Zak Date: Tue, 28 May 2019 09:58:51 +0000 (+0200) Subject: lscpu: make lookup() use more consistent [coverity scan] X-Git-Tag: v2.34-rc2~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fe2e38f3b15f397aa1edc768237e9408c8a688f9;p=thirdparty%2Futil-linux.git lscpu: make lookup() use more consistent [coverity scan] We usually check lookup() return value. Let's do it in this case too. It seems static analyzers will be happy with consistent code. Signed-off-by: Karel Zak --- diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index f64d81836d..48b3764585 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -626,8 +626,10 @@ read_basicinfo(struct lscpu_desc *desc, struct lscpu_modifier *mod) read_physical_info_powerpc(desc); if ((fp = ul_path_fopen(desc->procfs, "r", "sysinfo"))) { - while (fgets(buf, sizeof(buf), fp) != NULL && !desc->machinetype) - lookup(buf, "Type", &desc->machinetype); + while (fgets(buf, sizeof(buf), fp) != NULL) { + if (lookup(buf, "Type", &desc->machinetype)) + break; + } fclose(fp); }