Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1658615

Re: [PATCH] spi: pxa2xx: Handle return value of clk_prepare_enable

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] spi: pxa2xx: Handle return value of clk_prepare_enable
Date 2017-06-06 13:00 +0200
Message-ID <tPkno-7Bq-29@gated-at.bofh.it> (permalink)
References <tPjhF-6Wc-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jun 6, 2017 at 12:44 PM, Arvind Yadav <arvind.yadav.cs@gmail.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

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] spi: pxa2xx: Handle return value of clk_prepare_enable Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-06-06 11:50 +0200
  Re: [PATCH] spi: pxa2xx: Handle return value of clk_prepare_enable Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-06 13:00 +0200
    Re: [PATCH] spi: pxa2xx: Handle return value of clk_prepare_enable Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-06-06 13:40 +0200

csiph-web