diff options
author | Alex Elder <elder@linaro.org> | 2016-05-24 13:34:48 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-05-27 11:28:16 -0700 |
commit | ebc9e3750d3112e3a84fe65386cb0e5deb994e18 (patch) | |
tree | 12c22d1a72de72537e32e8e8b6e4110402383a1a /drivers | |
parent | f9340fc7dd9f42edfcd7a0e332798ae01a6b48ac (diff) |
greybus: fix unbalanced mutex
Running "make coccicheck" on the Greybus code reports that
gb_mmc_get_ro() and gb_mmc_get_cd() can return without releasing
the mutex it acquired if there's an error. Fix this.
Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/greybus/sdio.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c index 4d4cfdf8edb6..bdcc86923c54 100644 --- a/drivers/staging/greybus/sdio.c +++ b/drivers/staging/greybus/sdio.c @@ -684,9 +684,12 @@ static int gb_mmc_get_ro(struct mmc_host *mmc) struct gb_sdio_host *host = mmc_priv(mmc); mutex_lock(&host->lock); - if (host->removed) + if (host->removed) { + mutex_unlock(&host->lock); return -ESHUTDOWN; + } mutex_unlock(&host->lock); + return host->read_only; } @@ -695,9 +698,12 @@ static int gb_mmc_get_cd(struct mmc_host *mmc) struct gb_sdio_host *host = mmc_priv(mmc); mutex_lock(&host->lock); - if (host->removed) + if (host->removed) { + mutex_unlock(&host->lock); return -ESHUTDOWN; + } mutex_unlock(&host->lock); + return host->card_present; } |