svn commit: r360131 - head/sys/dev/acpica

Conrad Meyer cem at FreeBSD.org
Mon Apr 20 18:01:45 UTC 2020


Author: cem
Date: Mon Apr 20 18:01:45 2020
New Revision: 360131
URL: https://svnweb.freebsd.org/changeset/base/360131

Log:
  acpi_ec(4): Do not probe "successfully" if an error occurred
  
  All of the 'goto out;' cases in this probe routine without explicit
  initialization of 'ret' indicate error cases and were clearly intended
  to use the initial definition of 'ret' with ENXIO.  However, 'ret' was
  accidentally squashed by reuse for a subroutine call near the beginning
  of probe.
  
  Use a different variable for the subroutine status to preserve ENXIO ret
  for the 'goto out's as a minimal solution to the panic reported at attach
  for now.
  
  PR:	245757

Modified:
  head/sys/dev/acpica/acpi_ec.c

Modified: head/sys/dev/acpica/acpi_ec.c
==============================================================================
--- head/sys/dev/acpica/acpi_ec.c	Mon Apr 20 17:48:10 2020	(r360130)
+++ head/sys/dev/acpica/acpi_ec.c	Mon Apr 20 18:01:45 2020	(r360131)
@@ -344,7 +344,7 @@ acpi_ec_probe(device_t dev)
     device_t	peer;
     char	desc[64];
     int		ecdt;
-    int		ret;
+    int		ret, rc;
     struct acpi_ec_params *params;
     static char *ec_ids[] = { "PNP0C09", NULL };
 
@@ -368,9 +368,9 @@ acpi_ec_probe(device_t dev)
     } else
 	ecdt = 0;
 
-    ret = ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids, NULL);
-    if (ret > 0)
-	return (ret);
+    rc = ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids, NULL);
+    if (rc > 0)
+	return (rc);
 
     params = malloc(sizeof(struct acpi_ec_params), M_TEMP, M_WAITOK | M_ZERO);
 
@@ -398,7 +398,6 @@ acpi_ec_probe(device_t dev)
     peer = devclass_get_device(acpi_ec_devclass, params->uid);
     if (peer != NULL && device_is_alive(peer)) {
 	device_disable(dev);
-	ret = ENXIO;
 	goto out;
     }
 


More information about the svn-src-all mailing list