ACPI: Do not pass NULL to acpi_get_handle() when looking for _EJD
PATCH 1/1 ACPI: Do not pass NULL to acpi_get_handle() when looking for _EJD
When trying to get the acpi_handle from an acpi_buffer, pass ACPI_ROOT_OBJECT instead of NULL to acpi_get_handle(). This fixes the detection of dock dependent bays.
---
drivers/acpi/scan.c +2 -1
@@ -609,7 +609,8 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) status =acpi_evaluate_object (handle,"_EJD" ,NULL , &buffer);if (ACPI_SUCCESS (status)) { obj = buffer.pointer; - status =acpi_get_handle (NULL , obj->string.pointer, ejd); + status =acpi_get_handle (ACPI_ROOT_OBJECT , obj->string.pointer, + ejd);kfree (buffer.pointer); }return status;
Quoted 14 lines · Holger Macht
When trying to get the
acpi_handlefrom anacpi_buffer, passACPI_ROOT_OBJECTinstead of NULL toacpi_get_handle(). This fixes the detection of dock dependent bays.Signed-off-by Holger Macht <[email protected]>---
drivers/acpi/scan.c +0
-0
drivers/acpi/scan.c acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) · line 616
Quoted 9 lines
drivers/acpi/scan.c +2
-1@@ -609,7 +609,8 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) status =acpi_evaluate_object (handle,"_EJD" ,NULL , &buffer);if (ACPI_SUCCESS (status)) { obj = buffer.pointer; - status =acpi_get_handle (NULL , obj->string.pointer, ejd); + status =acpi_get_handle (ACPI_ROOT_OBJECT , obj->string.pointer, + ejd);kfree (buffer.pointer); }return status;
I can verify that acpi_bus_get_ejd is totally useless without that patch.
If "status = acpi_evaluate_object(handle, "_EJD", NULL, &buffer);" succeeds (and AE_NOT_FOUND is not returned), the function will return AE_BAD_PARAMETER, because NULL never makes sense as first argument of acpi_get_handle:
status = acpi_get_handle(NULL, obj->string.pointer, ejd);
I can also verify that the correct handle is evaluated with this patch on a recent ThinkPad, otherwise not.
Please add it, looks like a typo.
Thomas
Quoted 19 lines · Thomas Renninger
Quoted 18 lines · Holger Macht
When trying to get the
acpi_handlefrom anacpi_buffer, passACPI_ROOT_OBJECTinstead of NULL toacpi_get_handle(). This fixes the detection of dock dependent bays.Signed-off-by Holger Macht <[email protected]>---
drivers/acpi/scan.c +1
-1@@ -609,7 +609,8 @@ acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) status =acpi_evaluate_object (handle,"_EJD" ,NULL , &buffer);if (ACPI_SUCCESS (status)) { obj = buffer.pointer; - status =acpi_get_handle (NULL , obj->string.pointer, ejd); + status = acpi_get_handle(ACPI_ROOT_OBJECT, obj->string.pointer,
Quoted 8 lines
drivers/acpi/scan.c acpi_bus_get_ejd(acpi_handle handle, acpi_handle *ejd) · line 616
Quoted 5 lines
drivers/acpi/scan.c +1
-0+ ejd);kfree (buffer.pointer); }return status;I can verify that
acpi_bus_get_ejdis totally useless without that patch.
I mean I have verified and can confirm that..
Quoted 8 lines
If "status =
acpi_evaluate_object(handle, "_EJD", NULL, &buffer);" succeeds (andAE_NOT_FOUNDis not returned), the function will returnAE_BAD_PARAMETER, because NULL never makes sense as first argument ofacpi_get_handle:
status =acpi_get_handle(NULL, obj->string.pointer, ejd);I can also verify that the correct handle is evaluated with this patch on a recent ThinkPad, otherwise not.
Same here.
Quoted 1 line
Please add it, looks like a typo.
Thomas