[PATCH] lscpu: prefer model over revision for the Model field

Lokanadha M R <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
Current logic prefers ct->revision over ct->model whenever
revision is set. This is not appropriate for any
architecture that populates both fields, because the CPU
model (part number) is the meaningful identifier for the
"Model:" line, not the revision.

Make ct->model take precedence and use ct->revision only as
a fallback.

Signed-off-by: Lokanadha M R <[email protected]>
---
 sys-utils/lscpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index deb9b12bd..e52dc6312 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -910,7 +910,7 @@ print_summary_cputype(struct lscpu_cxt *cxt,
 	if (ct->family)
 		add_summary_s(tb, sec, _("CPU family:"), ct->family);
 	if (ct->model || ct->revision)
-		add_summary_s(tb, sec, _("Model:"), ct->revision ? ct->revision : ct->model);
+		add_summary_s(tb, sec, _("Model:"), ct->model ?: ct->revision);
 
 	add_summary_n(tb, sec, _("Thread(s) per core:"), ct->nthreads_per_core);
 	if (cxt->is_cluster)
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.