3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Tobias Jordan <Tobias.Jordan@xxxxxxxxxxxxxx> commit 62bbc864d1946c715063bd481bff3641fd1324e2 upstream. clk_prepare_enable() can fail, so its return value should be checked and acted upon. Found by Linux Driver Verification project (linuxtesting.org). Fixes: 3343b7a6d2cd ("spi/pxa2xx: convert to the common clk framework") Signed-off-by: Tobias Jordan <Tobias.Jordan@xxxxxxxxxxxxxx> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx> --- drivers/spi/spi-pxa2xx.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1182,7 +1182,9 @@ static int pxa2xx_spi_probe(struct platf } /* Enable SOC clock */ - clk_prepare_enable(ssp->clk); + status = clk_prepare_enable(ssp->clk); + if (status) + goto out_error_dma_irq_alloc; drv_data->max_clk_rate = clk_get_rate(ssp->clk); @@ -1221,6 +1223,8 @@ static int pxa2xx_spi_probe(struct platf out_error_clock_enabled: clk_disable_unprepare(ssp->clk); + +out_error_dma_irq_alloc: pxa2xx_spi_dma_release(drv_data); free_irq(ssp->irq, drv_data); @@ -1296,8 +1300,11 @@ static int pxa2xx_spi_resume(struct devi pxa2xx_spi_dma_resume(drv_data); /* 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) + return status; + } /* Restore LPSS private register bits */ lpss_ssp_setup(drv_data); @@ -1325,9 +1332,10 @@ static int pxa2xx_spi_runtime_suspend(st static int pxa2xx_spi_runtime_resume(struct device *dev) { struct driver_data *drv_data = dev_get_drvdata(dev); + int status; - clk_prepare_enable(drv_data->ssp->clk); - return 0; + status = clk_prepare_enable(drv_data->ssp->clk); + return status; } #endif