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: <CAHp75Vf3s0+RrHnBoO4y4+t4Egth4uyYwtO5iPt9DbLJcunL6g@mail.gmail.com>
Date:   Thu, 27 Aug 2020 11:27:12 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Krzysztof Kozlowski <krzk@...nel.org>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...com>,
        Fabrice Gasnier <fabrice.gasnier@...com>,
        Etienne Carriere <etienne.carriere@...com>,
        Alexandru Ardelean <alexandru.ardelean@...log.com>,
        linux-iio <linux-iio@...r.kernel.org>,
        linux-stm32@...md-mailman.stormreply.com,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] iio: adc: stm32: Simplify with dev_err_probe()

On Wed, Aug 26, 2020 at 7:19 PM Krzysztof Kozlowski <krzk@...nel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.






>         priv->aclk = devm_clk_get(&pdev->dev, "adc");
>         if (IS_ERR(priv->aclk)) {
>                 ret = PTR_ERR(priv->aclk);
> -               if (ret != -ENOENT) {
> -                       if (ret != -EPROBE_DEFER)
> -                               dev_err(&pdev->dev, "Can't get 'adc' clock\n");
> -                       return ret;
> -               }
> +               if (ret != -ENOENT)
> +                       return dev_err_probe(&pdev->dev, ret, "Can't get 'adc' clock\n");
> +
>                 priv->aclk = NULL;
>         }
>
>         priv->bclk = devm_clk_get(&pdev->dev, "bus");
>         if (IS_ERR(priv->bclk)) {
>                 ret = PTR_ERR(priv->bclk);
> -               if (ret != -ENOENT) {
> -                       if (ret != -EPROBE_DEFER)
> -                               dev_err(&pdev->dev, "Can't get 'bus' clock\n");
> -                       return ret;
> -               }
> +               if (ret != -ENOENT)
> +                       return dev_err_probe(&pdev->dev, ret, "Can't get 'bus' clock\n");
> +
>                 priv->bclk = NULL;
>         }

Again, devm_clk_get_optional() and even, if it exists,
devm_clk_bulk_get_optional().

Please, revisit all patches on this topic.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ