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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 19 Feb 2020 16:05:36 -0800
From:   Stephen Boyd <swboyd@...omium.org>
To:     Amit Kucheria <amit.kucheria@...aro.org>,
        Andy Gross <agross@...nel.org>, bjorn.andersson@...aro.org,
        daniel.lezcano@...aro.org, linux-arm-msm@...r.kernel.org,
        linux-kernel@...r.kernel.org, sivaa@...eaurora.org
Cc:     Amit Kucheria <amit.kucheria@...durent.com>,
        linux-pm@...r.kernel.org
Subject: Re: [PATCH v5 5/8] drivers: thermal: tsens: Add critical interrupt support

Quoting Amit Kucheria (2020-02-18 10:12:09)
> diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
> index 0e7cf5236932..5b003d598234 100644
> --- a/drivers/thermal/qcom/tsens.c
> +++ b/drivers/thermal/qcom/tsens.c
> @@ -125,6 +125,28 @@ static int tsens_register(struct tsens_priv *priv)
>                 goto err_put_device;
>         }
>  
> +       if (priv->feat->crit_int) {
> +               irq_crit = platform_get_irq_byname(pdev, "critical");
> +               if (irq_crit < 0) {
> +                       ret = irq_crit;
> +                       /* For old DTs with no IRQ defined */
> +                       if (irq_crit == -ENXIO)
> +                               ret = 0;
> +                       goto err_crit_int;
> +               }
> +               ret = devm_request_threaded_irq(&pdev->dev, irq_crit,
> +                                               NULL, tsens_critical_irq_thread,
> +                                               IRQF_ONESHOT,
> +                                               dev_name(&pdev->dev), priv);
> +               if (ret) {
> +                       dev_err(&pdev->dev, "%s: failed to get critical irq\n", __func__);
> +                       goto err_crit_int;
> +               }
> +
> +               enable_irq_wake(irq_crit);
> +       }
> +
> +err_crit_int:

Why use a goto? Can't this be done with if-else statements?

       if (priv->feat->crit_int) {
               irq_crit = platform_get_irq_byname(pdev, "critical");
               if (irq_crit < 0) {
                       ...
               } else {
                       ret = devm_request_threaded_irq(&pdev->dev, irq_crit,
                                                       NULL, tsens_critical_irq_thread,
                                                       IRQF_ONESHOT,
                                                       dev_name(&pdev->dev), priv);
                       if (ret)
                               dev_err(&pdev->dev, "%s: failed to get critical irq\n", __func__);
                       else
                               enable_irq_wake(irq_crit);
               }
       }

Or if the nesting is so deep that we need goto labels then perhaps it
needs to be another function.

>         enable_irq_wake(irq);
>  
>  err_put_device:

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ