summaryrefslogtreecommitdiff
path: root/sound/soc/intel/skylake/skl-nhlt.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-01-08 15:54:50 +0000
committerMark Brown <broonie@kernel.org>2018-01-08 15:54:50 +0000
commit498495dba268b20e8eadd7fe93c140c68b6cc9d2 (patch)
tree00d1562049d8bc2194fddd9ba0cbbe0812ad6f68 /sound/soc/intel/skylake/skl-nhlt.c
parentd5cc0a1fcbb5ddbef9fdd4c4a978da3254ddbf37 (diff)
parent5c256045b87b8aa8e5bc9d2e2fdc0802351c1f99 (diff)
Merge branch 'fix/intel' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-intel
Diffstat (limited to 'sound/soc/intel/skylake/skl-nhlt.c')
-rw-r--r--sound/soc/intel/skylake/skl-nhlt.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c
index bde7f40f29f5..d9b3dc89a1dc 100644
--- a/sound/soc/intel/skylake/skl-nhlt.c
+++ b/sound/soc/intel/skylake/skl-nhlt.c
@@ -21,6 +21,8 @@
#include "skl.h"
#include "skl-i2s.h"
+#define NHLT_ACPI_HEADER_SIG "NHLT"
+
/* Unique identification for getting NHLT blobs */
static guid_t osc_guid =
GUID_INIT(0xA69F886E, 0x6CEB, 0x4594,
@@ -42,10 +44,18 @@ struct nhlt_acpi_table *skl_nhlt_init(struct device *dev)
obj = acpi_evaluate_dsm(handle, &osc_guid, 1, 1, NULL);
if (obj && obj->type == ACPI_TYPE_BUFFER) {
nhlt_ptr = (struct nhlt_resource_desc *)obj->buffer.pointer;
- nhlt_table = (struct nhlt_acpi_table *)
+ if (nhlt_ptr->length)
+ nhlt_table = (struct nhlt_acpi_table *)
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;
}