From 070ee365e3d73d42073d85c8795b8d4b10e59d0a Mon Sep 17 00:00:00 2001
From: Thomas Schlichter <thomas.schlichter@iis.fraunhofer.de>
Date: Wed, 26 Aug 2020 16:46:48 +0200
Subject: [PATCH] Fixup dlsch harq if() conditions in nr_dlsch_demodulation.c

---
 .../PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c     | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
index f2dd5fb0d5d..56cbd32facf 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
@@ -186,7 +186,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
     break;
   }
 
-  if (dlsch1_harq){
+  if (dlsch0_harq && dlsch1_harq){
 
     //printf("status TB0 = %d, status TB1 = %d \n", dlsch[0]->harq_processes[harq_pid]->status, dlsch[1]->harq_processes[harq_pid]->status);
     LOG_D(PHY,"AbsSubframe %d.%d / Sym %d harq_pid %d, harq status %d.%d \n", frame, nr_tti_rx, symbol, harq_pid, dlsch0_harq->status, dlsch1_harq->status);
@@ -227,19 +227,18 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
       return(-1);
     }
   } else if (dlsch0_harq) {
-    if (dlsch0_harq->status == ACTIVE)
+    if (dlsch0_harq->status == ACTIVE) {
       codeword_TB0 = dlsch0_harq->codeword;
       dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
 
       #ifdef DEBUG_HARQ
         printf("[DEMOD] I am assuming only TB0 is active\n");
       #endif
+    } else {
+      LOG_E(PHY,"[UE][FATAL] nr_tti_rx %d: no active DLSCH\n", nr_tti_rx);
+      return (-1);
+    }
   } else {
-    LOG_E(PHY,"[UE][FATAL] nr_tti_rx %d: no active DLSCH\n", nr_tti_rx);
-    return (-1);
-  }
-
-  if (dlsch0_harq == NULL) {
     LOG_E(PHY, "Done\n");
     return -1;
   }
-- 
GitLab