lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE9FiQWiOAdDC15g+y1JRc7_tG=EzVckdNPYYJpWsftJAkEZsg@mail.gmail.com>
Date:	Thu, 31 Jan 2013 10:43:46 -0800
From:	Yinghai Lu <yinghai@...nel.org>
To:	"Rafael J. Wysocki" <rjw@...k.pl>
Cc:	ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Mika Westerberg <mika.westerberg@...ux.intel.com>,
	Toshi Kani <toshi.kani@...com>
Subject: Re: [PATCH 2/2] ACPI / scan: Clean up acpi_bus_get_parent()

On Wed, Jan 30, 2013 at 2:04 PM, Rafael J. Wysocki <rjw@...k.pl> wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>
> Make acpi_bus_get_parent() more straightforward and remove an
> unnecessary local variable ret from it.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
>  drivers/acpi/scan.c |   16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
>
> Index: test/drivers/acpi/scan.c
> ===================================================================
> --- test.orig/drivers/acpi/scan.c
> +++ test/drivers/acpi/scan.c
> @@ -871,29 +871,23 @@ EXPORT_SYMBOL(acpi_bus_unregister_driver
>     -------------------------------------------------------------------------- */
>  static struct acpi_device *acpi_bus_get_parent(acpi_handle handle)
>  {
> +       struct acpi_device *device = NULL;
>         acpi_status status;
> -       int ret;
> -       struct acpi_device *device;
>
>         /*
>          * Fixed hardware devices do not appear in the namespace and do not
>          * have handles, but we fabricate acpi_devices for them, so we have
>          * to deal with them specially.
>          */
> -       if (handle == NULL)
> +       if (!handle)
>                 return acpi_root;
>
>         do {
>                 status = acpi_get_parent(handle, &handle);
> -               if (status == AE_NULL_ENTRY)
> -                       return NULL;
>                 if (ACPI_FAILURE(status))
> -                       return acpi_root;
> -
> -               ret = acpi_bus_get_device(handle, &device);
> -               if (ret == 0)
> -                       return device;
> -       } while (1);
> +                       return status == AE_NULL_ENTRY ? NULL : acpi_root;
> +       } while (acpi_bus_get_device(handle, &device));
> +       return device;
>  }

Acked-by: Yinghai Lu <yinghai@...nel.org>

>
>  acpi_status
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ