[2/3] ACPI: Remove acpi_has_method() call from scan.c
diff mbox series

Message ID 20190722023530.67676-3-skunberg.kelsey@gmail.com
State Under Review
Headers show
Series
  • ACPI: Remove unnecessary acpi_has_method() calls
Related show

Commit Message

Kelsey Skunberg July 22, 2019, 2:35 a.m. UTC
acpi_evaluate_reference() will return an error if the DEP method
does not exist. Checking if the DEP method exists before the
acpi_evaluate_reference() call is not needed. Remove acpi_has_method()
call to avoid additional work.

Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
---
 drivers/acpi/scan.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Rafael J. Wysocki July 22, 2019, 8:29 a.m. UTC | #1
On Mon, Jul 22, 2019 at 4:36 AM Kelsey Skunberg
<skunberg.kelsey@gmail.com> wrote:
>
> acpi_evaluate_reference() will return an error if the DEP method
> does not exist. Checking if the DEP method exists before the
> acpi_evaluate_reference() call is not needed. Remove acpi_has_method()
> call to avoid additional work.
>
> Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
> ---
>  drivers/acpi/scan.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 0e28270b0fd8..4f2b0b481cee 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -1803,9 +1803,6 @@ static void acpi_device_dep_initialize(struct acpi_device *adev)
>
>         adev->dep_unmet = 0;
>
> -       if (!acpi_has_method(adev->handle, "_DEP"))
> -               return;
> -

As you can see, this just returns.

>         status = acpi_evaluate_reference(adev->handle, "_DEP", NULL,
>                                         &dep_devices);
>         if (ACPI_FAILURE(status)) {

Where this does something more on fallure.

Therefore the code after the change is not equivalent to the code
before it, so the changes is questionable.

Patch
diff mbox series

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 0e28270b0fd8..4f2b0b481cee 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1803,9 +1803,6 @@  static void acpi_device_dep_initialize(struct acpi_device *adev)
 
 	adev->dep_unmet = 0;
 
-	if (!acpi_has_method(adev->handle, "_DEP"))
-		return;
-
 	status = acpi_evaluate_reference(adev->handle, "_DEP", NULL,
 					&dep_devices);
 	if (ACPI_FAILURE(status)) {