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] [day] [month] [year] [list]
Message-ID: <CAJZ5v0j5UH52ze=wL_kc394ojaudkaAKGp5=x6-bq4dEnPHp-g@mail.gmail.com>
Date:   Thu, 24 Oct 2019 14:38:57 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] driver core: platform: Declare ret variable only once

On Wed, Oct 23, 2019 at 2:25 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> We may define ret variable only once and avoid adding it each time
> platform_get_irq_optional() get extended.
>
> For the sake of consistency do the same in __platform_get_irq_byname().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

Fine by me:

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

> ---
>  drivers/base/platform.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index e0ca682a756d..dad9806875f7 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -106,9 +106,9 @@ int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
>         return dev->archdata.irqs[num];
>  #else
>         struct resource *r;
> -       if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) {
> -               int ret;
> +       int ret;
>
> +       if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) {
>                 ret = of_irq_get(dev->dev.of_node, num);
>                 if (ret > 0 || ret == -EPROBE_DEFER)
>                         return ret;
> @@ -117,8 +117,6 @@ int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
>         r = platform_get_resource(dev, IORESOURCE_IRQ, num);
>         if (has_acpi_companion(&dev->dev)) {
>                 if (r && r->flags & IORESOURCE_DISABLED) {
> -                       int ret;
> -
>                         ret = acpi_irq_get(ACPI_HANDLE(&dev->dev), num, r);
>                         if (ret)
>                                 return ret;
> @@ -151,8 +149,7 @@ int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
>          * allows a common code path across either kind of resource.
>          */
>         if (num == 0 && has_acpi_companion(&dev->dev)) {
> -               int ret = acpi_dev_gpio_irq_get(ACPI_COMPANION(&dev->dev), num);
> -
> +               ret = acpi_dev_gpio_irq_get(ACPI_COMPANION(&dev->dev), num);
>                 /* Our callers expect -ENXIO for missing IRQs. */
>                 if (ret >= 0 || ret == -EPROBE_DEFER)
>                         return ret;
> @@ -240,10 +237,9 @@ static int __platform_get_irq_byname(struct platform_device *dev,
>                                      const char *name)
>  {
>         struct resource *r;
> +       int ret;
>
>         if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) {
> -               int ret;
> -
>                 ret = of_irq_get_byname(dev->dev.of_node, name);
>                 if (ret > 0 || ret == -EPROBE_DEFER)
>                         return ret;
> --
> 2.23.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ