platform/x86: intel_pmt_telemetry: Ignore zero sized entries
authorDavid E. Box <david.e.box@linux.intel.com>
Tue, 17 Aug 2021 22:40:17 +0000 (15:40 -0700)
committerHans de Goede <hdegoede@redhat.com>
Fri, 20 Aug 2021 10:09:41 +0000 (12:09 +0200)
Some devices may expose non-functioning entries that are reserved for
future use. These entries have zero size. Ignore them during probe.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Link: https://lore.kernel.org/r/20210817224018.1013192-5-david.e.box@linux.intel.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/intel/pmt/telemetry.c

index a58843360fbf6494293c7ed425ba8f9ff8624787..38d52651c5729e08339db452d2e19c8c1fab820f 100644 (file)
@@ -61,6 +61,14 @@ static int pmt_telem_header_decode(struct intel_pmt_entry *entry,
        /* Size is measured in DWORDS, but accessor returns bytes */
        header->size = TELEM_SIZE(readl(disc_table));
 
+       /*
+        * Some devices may expose non-functioning entries that are
+        * reserved for future use. They have zero size. Do not fail
+        * probe for these. Just ignore them.
+        */
+       if (header->size == 0)
+               return 1;
+
        return 0;
 }