mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 08:46:46 +00:00
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>
This commit is contained in:
parent
f9340fc7dd
commit
ebc9e3750d
1 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue