svn commit: r342104 - head/sys/dev/tpm

Marcin Wojtas mw at FreeBSD.org
Fri Dec 14 22:22:45 UTC 2018


Author: mw
Date: Fri Dec 14 22:22:43 2018
New Revision: 342104
URL: https://svnweb.freebsd.org/changeset/base/342104

Log:
  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

Modified:
  head/sys/dev/tpm/tpm_crb.c
  head/sys/dev/tpm/tpm_tis.c

Modified: head/sys/dev/tpm/tpm_crb.c
==============================================================================
--- head/sys/dev/tpm/tpm_crb.c	Fri Dec 14 21:30:34 2018	(r342103)
+++ head/sys/dev/tpm/tpm_crb.c	Fri Dec 14 22:22:43 2018	(r342104)
@@ -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);

Modified: head/sys/dev/tpm/tpm_tis.c
==============================================================================
--- head/sys/dev/tpm/tpm_tis.c	Fri Dec 14 21:30:34 2018	(r342103)
+++ head/sys/dev/tpm/tpm_tis.c	Fri Dec 14 22:22:43 2018	(r342104)
@@ -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);


More information about the svn-src-head mailing list