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]
Date:   Tue, 6 Jun 2017 13:54:37 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Arvind Yadav <arvind.yadav.cs@...il.com>
Cc:     Daniel Mack <daniel@...que.org>,
        Haojian Zhuang <haojian.zhuang@...il.com>,
        Robert Jarzmik <robert.jarzmik@...e.fr>,
        Mark Brown <broonie@...nel.org>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        linux-spi <linux-spi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] spi: pxa2xx: Handle return value of clk_prepare_enable

On Tue, Jun 6, 2017 at 12:44 PM, Arvind Yadav <arvind.yadav.cs@...il.com> wrote:
> clk_prepare_enable() can fail here and we must check its return value.

> @@ -1676,7 +1676,11 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)

> -       clk_prepare_enable(ssp->clk);
> +       status = clk_prepare_enable(ssp->clk);

This one looks fine.

> @@ -1855,8 +1859,13 @@ static int pxa2xx_spi_resume(struct device *dev)

>         /* Enable the SSP clock */
> -       if (!pm_runtime_suspended(dev))
> -               clk_prepare_enable(ssp->clk);
> +       if (!pm_runtime_suspended(dev)) {
> +               status = clk_prepare_enable(ssp->clk);
> +               if (status) {
> +                       dev_err(dev, "Failed to prepare clock\n");
> +                       return status;
> +               }

This...

> @@ -1886,8 +1895,7 @@ static int pxa2xx_spi_runtime_resume(struct device *dev)
>  {
>         struct driver_data *drv_data = dev_get_drvdata(dev);
>
> -       clk_prepare_enable(drv_data->ssp->clk);
> -       return 0;
> +       return clk_prepare_enable(drv_data->ssp->clk);

...and especially this should be carefully checked since there are
differences in behaviour how system or driver will be resumed.

So, the question is how did you test it?

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ