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>
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;
}
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;
}