Browse Source

qcacmn: fix runtime PM get/put out of sync

Currently, in get_htc_send_packets() when the
hif_system_pm_state_check() fails, we are not doing a
runtime PM put operation for the corresponding get operation.
This imbalance will never make the system enter runtime suspend
state and also we do a BUG() when such imbalance is encountered
during runtime PM deinit. This change also fixes a potential
memory leak.

Change-Id: I3e5916005d583de42a49dd2dc0632bfcca1251e4
CRs-Fixed: 2947247
Manikanta Pubbisetty 4 years ago
parent
commit
536d86610b
1 changed files with 7 additions and 4 deletions
  1. 7 4
      htc/htc_send.c

+ 7 - 4
htc/htc_send.c

@@ -1342,16 +1342,19 @@ static void get_htc_send_packets(HTC_TARGET *target,
 			}
 		}
 
-		pPacket = htc_packet_dequeue(tx_queue);
-		if (!pPacket) {
+		ret = hif_system_pm_state_check(target->hif_dev);
+		if (ret) {
 			if (do_pm_get)
 				hif_pm_runtime_put(target->hif_dev, rtpm_dbgid);
 			break;
 		}
 
-		ret = hif_system_pm_state_check(target->hif_dev);
-		if (ret)
+		pPacket = htc_packet_dequeue(tx_queue);
+		if (!pPacket) {
+			if (do_pm_get)
+				hif_pm_runtime_put(target->hif_dev, rtpm_dbgid);
 			break;
+		}
 
 		AR_DEBUG_PRINTF(ATH_DEBUG_SEND,
 				(" Got packet:%pK , New Queue Depth: %d\n",