Merge "slim_msm: Make sure runtime PM reference count doesn't go -ve" into msm-3.0
diff --git a/drivers/slimbus/slim-msm-ctrl.c b/drivers/slimbus/slim-msm-ctrl.c
index aa67c8c..6c5b380 100644
--- a/drivers/slimbus/slim-msm-ctrl.c
+++ b/drivers/slimbus/slim-msm-ctrl.c
@@ -354,8 +354,13 @@
 static void msm_slim_put_ctrl(struct msm_slim_ctrl *dev)
 {
 #ifdef CONFIG_PM_RUNTIME
+	int ref;
 	pm_runtime_mark_last_busy(dev->dev);
-	pm_runtime_put(dev->dev);
+	ref = atomic_read(&dev->dev->power.usage_count);
+	if (ref <= 0)
+		dev_err(dev->dev, "reference count mismatch:%d", ref);
+	else
+		pm_runtime_put(dev->dev);
 #endif
 }