msm: ipa3: Changes to fix header offset usage in DDR case

When DDR header table was full not verifying any free offset entries
present in the list with current logic. So adding changes to use
free offset location in DDR when DDR header table was full.

Change-Id: If2d010db178e2388a83b5b63b47d3d05f2c3f7e2
Signed-off-by: Ashok Vuyyuru <quic_avuyyuru@quicinc.com>
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c b/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c
index 6b74697..f4525e8 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_hdr.c
@@ -658,14 +658,14 @@
 				entry->is_lcl = false;
 			}
 
-			if (!entry->is_lcl && (htbl->end + ipa_hdr_bin_sz[bin] > mem_size)) {
-				IPAERR("No space in DDR header buffer! Requested: %d Left: %d name %s, end %d\n",
-					ipa_hdr_bin_sz[bin], mem_size - htbl->end, entry->name, htbl->end);
-				goto bad_hdr_len;
-			}
-
 			/* check if DDR free list */
 			if (list_empty(&htbl->head_free_offset_list[bin])) {
+				if (!entry->is_lcl && (htbl->end + ipa_hdr_bin_sz[bin] > mem_size)) {
+					IPAERR("No space in DDR header buffer! Requested: %d Left: %d name %s, end %d\n",
+							ipa_hdr_bin_sz[bin], mem_size - htbl->end, entry->name, htbl->end);
+					goto bad_hdr_len;
+				}
+
 				IPADBG_LOW("No free offset in DDR allocating new offset Requested: %d Left: %d name %s, end %d\n",
 						ipa_hdr_bin_sz[bin], mem_size - htbl->end, entry->name, htbl->end);
 				goto create_entry;