From 24c09c2fdf65cc4a4d16c3c72e27c90d31f2fe21 Mon Sep 17 00:00:00 2001 From: Subhash Jadavani Date: Thu, 15 Oct 2015 12:16:43 -0700 Subject: [PATCH] mmc: sdhci-msm: don't bug on PM QoS request counter going negative Currently we are crashing the system if PM QoS request counter goes negative but this doesn't seem to be right way to handle. We should instead skip decrementing this counter once it reaches 0 and just print a dump stack to know the callstack. This change fixes this as mentioned above. Change-Id: I36fb03b1ddf8e04ecc9fe449496b656db84e77d2 Signed-off-by: Subhash Jadavani --- drivers/mmc/host/sdhci-msm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index cf390ff7a73c..246a31ad539a 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -3217,11 +3217,13 @@ void sdhci_msm_pm_qos_irq_unvote(struct sdhci_host *host, bool async) if (!msm_host->pm_qos_irq.enabled) return; - counter = atomic_dec_return(&msm_host->pm_qos_irq.counter); - if (counter < 0) { - pr_err("%s: counter=%d\n", __func__, counter); - BUG(); + if (atomic_read(&msm_host->pm_qos_irq.counter)) { + counter = atomic_dec_return(&msm_host->pm_qos_irq.counter); + } else { + WARN(1, "attempt to decrement pm_qos_irq.counter when it's 0"); + return; } + if (counter) return;