dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/0125-lscpu-improve-for-offline-CPUs-on-AMD.patch

64664a
From 4150eb1025c059f9459f98ef6c6c3fac730eaf93 Mon Sep 17 00:00:00 2001
64664a
From: Karel Zak <kzak@redhat.com>
64664a
Date: Thu, 1 Jun 2017 12:07:41 +0200
64664a
Subject: [PATCH] lscpu: improve for offline CPUs on AMD
64664a
64664a
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1457744
64664a
Signed-off-by: Karel Zak <kzak@redhat.com>
64664a
---
64664a
 sys-utils/lscpu.c | 8 ++++----
64664a
 1 file changed, 4 insertions(+), 4 deletions(-)
64664a
64664a
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
64664a
index 683fd66..1ee73f3 100644
64664a
--- a/sys-utils/lscpu.c
64664a
+++ b/sys-utils/lscpu.c
64664a
@@ -1550,11 +1550,11 @@ get_cell_data(struct lscpu_desc *desc, int idx, int col,
64664a
 				 is_cpu_online(desc, cpu) ? _("yes") : _("no"));
64664a
 		break;
64664a
 	case COL_MAXMHZ:
64664a
-		if (desc->maxmhz)
64664a
+		if (desc->maxmhz && desc->maxmhz[idx])
64664a
 			xstrncpy(buf, desc->maxmhz[idx], bufsz);
64664a
 		break;
64664a
 	case COL_MINMHZ:
64664a
-		if (desc->minmhz)
64664a
+		if (desc->minmhz && desc->minmhz[idx])
64664a
 			xstrncpy(buf, desc->minmhz[idx], bufsz);
64664a
 		break;
64664a
 	}
64664a
@@ -1897,9 +1897,9 @@ print_summary(struct lscpu_desc *desc, struct lscpu_modifier *mod)
64664a
 		print_s(_("CPU dynamic MHz:"), desc->dynamic_mhz);
64664a
 	if (desc->static_mhz)
64664a
 		print_s(_("CPU static MHz:"), desc->static_mhz);
64664a
-	if (desc->maxmhz)
64664a
+	if (desc->maxmhz && desc->maxmhz[0])
64664a
 		print_s(_("CPU max MHz:"), desc->maxmhz[0]);
64664a
-	if (desc->minmhz)
64664a
+	if (desc->minmhz && desc->minmhz[0])
64664a
 		print_s(_("CPU min MHz:"), desc->minmhz[0]);
64664a
 	if (desc->bogomips)
64664a
 		print_s(_("BogoMIPS:"), desc->bogomips);
64664a
-- 
64664a
2.9.4
64664a