Commit ebc9e375 authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

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: default avatarAlex Elder <elder@linaro.org>
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent f9340fc7
......@@ -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;
}
......
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