spi: spi_qsd: Prevent unbalanced clock

If an error occurs trying to get resources such as gpio pins
the spi driver is trying to release resources it never aquired.
This patch checks the return status of the function that gets
the resources and skips releasing resources on if it fails.

Change-Id: Ib2a1c96d8d03d39dcd1444f803fe1e56f8162bed
Signed-off-by: Dan Sneddon <dsneddon@codeaurora.org>
This commit is contained in:
Dan Sneddon 2014-10-15 13:14:04 -06:00
parent 5518d1bee9
commit ddb2e52847
1 changed files with 5 additions and 1 deletions

View File

@ -1943,7 +1943,10 @@ static int msm_spi_setup(struct spi_device *spi)
dd = spi_master_get_devdata(spi->master);
pm_runtime_get_sync(dd->dev);
get_local_resources(dd);
rc = get_local_resources(dd);
if (rc)
goto no_resources;
mutex_lock(&dd->core_lock);
@ -1981,6 +1984,7 @@ static int msm_spi_setup(struct spi_device *spi)
err_setup_exit:
mutex_unlock(&dd->core_lock);
put_local_resources(dd);
no_resources:
pm_runtime_mark_last_busy(dd->dev);
pm_runtime_put_autosuspend(dd->dev);
return rc;