Takashi Iwai 5ce065
From ef195e8a7f43924b9979b2cd81ac7fa54f24bb3c Mon Sep 17 00:00:00 2001
Takashi Iwai 5ce065
From: "David E. Box" <david.e.box@linux.intel.com>
Takashi Iwai 5ce065
Date: Tue, 17 Aug 2021 15:40:17 -0700
Takashi Iwai 5ce065
Subject: [PATCH] platform/x86: intel_pmt_telemetry: Ignore zero sized entries
Takashi Iwai 5ce065
Git-commit: ef195e8a7f43924b9979b2cd81ac7fa54f24bb3c
Takashi Iwai 5ce065
Patch-mainline: v5.15-rc1
Takashi Iwai 5ce065
References: bsc#1196591
Takashi Iwai 5ce065
Takashi Iwai 5ce065
Some devices may expose non-functioning entries that are reserved for
Takashi Iwai 5ce065
future use. These entries have zero size. Ignore them during probe.
Takashi Iwai 5ce065
Takashi Iwai 5ce065
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Takashi Iwai 5ce065
Link: https://lore.kernel.org/r/20210817224018.1013192-5-david.e.box@linux.intel.com
Takashi Iwai 5ce065
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Takashi Iwai 5ce065
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Takashi Iwai 5ce065
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 5ce065
Takashi Iwai 5ce065
---
Takashi Iwai 5ce065
 drivers/platform/x86/intel/pmt/telemetry.c | 8 ++++++++
Takashi Iwai 5ce065
 1 file changed, 8 insertions(+)
Takashi Iwai 5ce065
Takashi Iwai 5ce065
diff --git a/drivers/platform/x86/intel/pmt/telemetry.c b/drivers/platform/x86/intel/pmt/telemetry.c
Takashi Iwai 5ce065
index a58843360fbf..38d52651c572 100644
Takashi Iwai 5ce065
--- a/drivers/platform/x86/intel/pmt/telemetry.c
Takashi Iwai 5ce065
+++ b/drivers/platform/x86/intel/pmt/telemetry.c
Takashi Iwai 5ce065
@@ -61,6 +61,14 @@ static int pmt_telem_header_decode(struct intel_pmt_entry *entry,
Takashi Iwai 5ce065
 	/* Size is measured in DWORDS, but accessor returns bytes */
Takashi Iwai 5ce065
 	header->size = TELEM_SIZE(readl(disc_table));
Takashi Iwai 5ce065
 
Takashi Iwai 5ce065
+	/*
Takashi Iwai 5ce065
+	 * Some devices may expose non-functioning entries that are
Takashi Iwai 5ce065
+	 * reserved for future use. They have zero size. Do not fail
Takashi Iwai 5ce065
+	 * probe for these. Just ignore them.
Takashi Iwai 5ce065
+	 */
Takashi Iwai 5ce065
+	if (header->size == 0)
Takashi Iwai 5ce065
+		return 1;
Takashi Iwai 5ce065
+
Takashi Iwai 5ce065
 	return 0;
Takashi Iwai 5ce065
 }
Takashi Iwai 5ce065
 
Takashi Iwai 5ce065
-- 
Takashi Iwai 5ce065
2.31.1
Takashi Iwai 5ce065