Commit 62bbc864 authored by Tobias Jordan's avatar Tobias Jordan Committed by Mark Brown

spi: pxa2xx: check clk_prepare_enable() return value

clk_prepare_enable() can fail, so its return value should be checked and
acted upon.

Found by Linux Driver Verification project (linuxtesting.org).

Fixes: 3343b7a6 ("spi/pxa2xx: convert to the common clk framework")
Signed-off-by: default avatarTobias Jordan <Tobias.Jordan@elektrobit.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6126fd83
...@@ -1612,7 +1612,9 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) ...@@ -1612,7 +1612,9 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
} }
/* Enable SOC clock */ /* Enable SOC clock */
clk_prepare_enable(ssp->clk); status = clk_prepare_enable(ssp->clk);
if (status)
goto out_error_dma_irq_alloc;
master->max_speed_hz = clk_get_rate(ssp->clk); master->max_speed_hz = clk_get_rate(ssp->clk);
...@@ -1716,6 +1718,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev) ...@@ -1716,6 +1718,8 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
pm_runtime_put_noidle(&pdev->dev); pm_runtime_put_noidle(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
clk_disable_unprepare(ssp->clk); clk_disable_unprepare(ssp->clk);
out_error_dma_irq_alloc:
pxa2xx_spi_dma_release(drv_data); pxa2xx_spi_dma_release(drv_data);
free_irq(ssp->irq, drv_data); free_irq(ssp->irq, drv_data);
...@@ -1789,8 +1793,11 @@ static int pxa2xx_spi_resume(struct device *dev) ...@@ -1789,8 +1793,11 @@ static int pxa2xx_spi_resume(struct device *dev)
int status; int status;
/* Enable the SSP clock */ /* Enable the SSP clock */
if (!pm_runtime_suspended(dev)) if (!pm_runtime_suspended(dev)) {
clk_prepare_enable(ssp->clk); status = clk_prepare_enable(ssp->clk);
if (status)
return status;
}
/* Restore LPSS private register bits */ /* Restore LPSS private register bits */
if (is_lpss_ssp(drv_data)) if (is_lpss_ssp(drv_data))
...@@ -1819,9 +1826,10 @@ static int pxa2xx_spi_runtime_suspend(struct device *dev) ...@@ -1819,9 +1826,10 @@ static int pxa2xx_spi_runtime_suspend(struct device *dev)
static int pxa2xx_spi_runtime_resume(struct device *dev) static int pxa2xx_spi_runtime_resume(struct device *dev)
{ {
struct driver_data *drv_data = dev_get_drvdata(dev); struct driver_data *drv_data = dev_get_drvdata(dev);
int status;
clk_prepare_enable(drv_data->ssp->clk); status = clk_prepare_enable(drv_data->ssp->clk);
return 0; return status;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment