dcavalca / rpms / util-linux

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