Blame SOURCES/0003-dmidecode-Simplify-the-formatting-of-memory-error-st.patch

fc71ac
From 1347ccca96db6e157af39fcc565466fa98b9220b Mon Sep 17 00:00:00 2001
fc71ac
From: Jean Delvare <jdelvare@suse.de>
fc71ac
Date: Mon, 23 Mar 2020 16:47:27 +0100
fc71ac
Subject: [PATCH 03/23] dmidecode: Simplify the formatting of memory error
fc71ac
 status
fc71ac
fc71ac
Make the logic more simple so that we always report the status on a
fc71ac
single line.
fc71ac
fc71ac
Signed-off-by: Jean Delvare <jdelvare@suse.de>
fc71ac
---
fc71ac
 dmidecode.c | 19 ++++++++++---------
fc71ac
 1 file changed, 10 insertions(+), 9 deletions(-)
fc71ac
fc71ac
diff --git a/dmidecode.c b/dmidecode.c
fc71ac
index ef9bbd54b7f8..5a0631e926c7 100644
fc71ac
--- a/dmidecode.c
fc71ac
+++ b/dmidecode.c
fc71ac
@@ -1515,18 +1515,19 @@ static void dmi_memory_module_size(u8 code)
fc71ac
 		printf(" (Single-bank Connection)");
fc71ac
 }
fc71ac
 
fc71ac
-static void dmi_memory_module_error(u8 code, const char *prefix)
fc71ac
+static void dmi_memory_module_error(u8 code)
fc71ac
 {
fc71ac
+	static const char *status[] = {
fc71ac
+		"OK", /* 0x00 */
fc71ac
+		"Uncorrectable Errors",
fc71ac
+		"Correctable Errors",
fc71ac
+		"Correctable and Uncorrectable Errors" /* 0x03 */
fc71ac
+	};
fc71ac
+
fc71ac
 	if (code & (1 << 2))
fc71ac
 		printf(" See Event Log\n");
fc71ac
 	else
fc71ac
-	{	if ((code & 0x03) == 0)
fc71ac
-			printf(" OK\n");
fc71ac
-		if (code & (1 << 0))
fc71ac
-			printf("%sUncorrectable Errors\n", prefix);
fc71ac
-		if (code & (1 << 1))
fc71ac
-			printf("%sCorrectable Errors\n", prefix);
fc71ac
-	}
fc71ac
+		printf(" %s\n", status[code & 0x03]);
fc71ac
 }
fc71ac
 
fc71ac
 /*
fc71ac
@@ -4142,7 +4143,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
fc71ac
 			dmi_memory_module_size(data[0x0A]);
fc71ac
 			printf("\n");
fc71ac
 			printf("\tError Status:");
fc71ac
-			dmi_memory_module_error(data[0x0B], "\t\t");
fc71ac
+			dmi_memory_module_error(data[0x0B]);
fc71ac
 			break;
fc71ac
 
fc71ac
 		case 7: /* 7.8 Cache Information */
fc71ac
-- 
fc71ac
2.17.1
fc71ac