Browse Source

qcacmn: fix the error by accessing pointer if not NULL

Fixing the errors of accessing pointer only if it not NULL.

Change-Id: Ie1e5ae4e4403956e3f9d4df7ca139804fe89d641
CRs-Fixed: 2741833
Vevek Venkatesan 5 years ago
parent
commit
7d59f8067a
1 changed files with 2 additions and 1 deletions
  1. 2 1
      hif/src/hif_runtime_pm.c

+ 2 - 1
hif/src/hif_runtime_pm.c

@@ -1636,7 +1636,7 @@ void hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx,
 			     struct hif_pm_runtime_lock *data)
 			     struct hif_pm_runtime_lock *data)
 {
 {
 	struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
 	struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
-	struct hif_runtime_pm_ctx *rpm_ctx = hif_bus_get_rpm_ctx(scn);
+	struct hif_runtime_pm_ctx *rpm_ctx;
 	struct hif_pm_runtime_lock *context = data;
 	struct hif_pm_runtime_lock *context = data;
 
 
 	if (!context) {
 	if (!context) {
@@ -1651,6 +1651,7 @@ void hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx,
 	 * before freeing the context if context is active.
 	 * before freeing the context if context is active.
 	 */
 	 */
 	if (scn) {
 	if (scn) {
+		rpm_ctx = hif_bus_get_rpm_ctx(scn);
 		spin_lock_bh(&rpm_ctx->runtime_lock);
 		spin_lock_bh(&rpm_ctx->runtime_lock);
 		__hif_pm_runtime_allow_suspend(scn, context);
 		__hif_pm_runtime_allow_suspend(scn, context);
 		spin_unlock_bh(&rpm_ctx->runtime_lock);
 		spin_unlock_bh(&rpm_ctx->runtime_lock);