Merge remote-tracking branch 'asoc/fix/intel' into asoc-linus
[sfrench/cifs-2.6.git] / sound / soc / intel / skylake / skl-nhlt.c
index e7d766d56c8e7dc60d12b39172f63c3a54f27b49..d14c50a602894c4ad8aa76f2259839552aff2f6a 100644 (file)
@@ -20,6 +20,8 @@
 #include <linux/pci.h>
 #include "skl.h"
 
+#define NHLT_ACPI_HEADER_SIG   "NHLT"
+
 /* Unique identification for getting NHLT blobs */
 static guid_t osc_guid =
        GUID_INIT(0xA69F886E, 0x6CEB, 0x4594,
@@ -45,6 +47,13 @@ struct nhlt_acpi_table *skl_nhlt_init(struct device *dev)
                                memremap(nhlt_ptr->min_addr, nhlt_ptr->length,
                                MEMREMAP_WB);
                ACPI_FREE(obj);
+               if (nhlt_table && (strncmp(nhlt_table->header.signature,
+                                       NHLT_ACPI_HEADER_SIG,
+                                       strlen(NHLT_ACPI_HEADER_SIG)) != 0)) {
+                       memunmap(nhlt_table);
+                       dev_err(dev, "NHLT ACPI header signature incorrect\n");
+                       return NULL;
+               }
                return nhlt_table;
        }