From c9073141b4582138f79059b9fe187b2bbd36ff83 Mon Sep 17 00:00:00 2001 From: Marcin Wojtas Date: Fri, 14 Dec 2018 22:22:43 +0000 Subject: [PATCH] Fix error check for ACPI_ID_PROBE in the TPM2.0 driver Updated API does not return pointer, so adjust the TPM2.0 driver accordingly. Reported by: jhb Obtained from: Semihalf Sponsored by: Stormshield --- sys/dev/tpm/tpm_crb.c | 7 ++++--- sys/dev/tpm/tpm_tis.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/dev/tpm/tpm_crb.c b/sys/dev/tpm/tpm_crb.c index cb6a0fdec14..c48109a0238 100644 --- a/sys/dev/tpm/tpm_crb.c +++ b/sys/dev/tpm/tpm_crb.c @@ -104,11 +104,12 @@ static int tpmcrb_acpi_probe(device_t dev) { struct resource *res; - int rid = 0; + int err, rid = 0; uint32_t caps; - if (ACPI_ID_PROBE(device_get_parent(dev), dev, tpmcrb_ids, NULL) == NULL) - return (ENXIO); + err = ACPI_ID_PROBE(device_get_parent(dev), dev, tpmcrb_ids, NULL); + if (err > 0) + return (err); /* Check if device is in CRB mode */ res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); diff --git a/sys/dev/tpm/tpm_tis.c b/sys/dev/tpm/tpm_tis.c index c5e4cafbfc0..93f1ae3f7b3 100644 --- a/sys/dev/tpm/tpm_tis.c +++ b/sys/dev/tpm/tpm_tis.c @@ -101,11 +101,12 @@ static int tpmtis_acpi_probe(device_t dev) { struct resource *res; - int rid = 0; + int err, rid = 0; uint32_t caps; - if (ACPI_ID_PROBE(device_get_parent(dev), dev, tpmtis_ids, NULL) == NULL) - return (ENXIO); + err = ACPI_ID_PROBE(device_get_parent(dev), dev, tpmtis_ids, NULL); + if (err > 0) + return (err); /* Check if device is in TPM 2.0 TIS mode */ res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);