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
This commit is contained in:
cem 2020-04-20 18:01:45 +00:00
parent ee2ca7c581
commit 650556588b

View File

@ -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;
}