qcacmn: Check precondition at start of hif_snoc_enable_bus
ol_sc null check needs to happen before it is dereferenced.
Change-Id: I11820668fcbcc59c87ee7c675aec2451da030075
CRs-Fixed: 1072077
diff --git a/hif/src/snoc/if_snoc.c b/hif/src/snoc/if_snoc.c
index 5eb123e..937b3ad 100644
--- a/hif/src/snoc/if_snoc.c
+++ b/hif/src/snoc/if_snoc.c
@@ -229,6 +229,12 @@
int ret;
int hif_type;
int target_type;
+
+ if (!ol_sc) {
+ HIF_ERROR("%s: hif_ctx is NULL", __func__);
+ return QDF_STATUS_E_NOMEM;
+ }
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(37));
#else
@@ -250,11 +256,6 @@
return ret;
}
- if (!ol_sc) {
- HIF_ERROR("%s: hif_ctx is NULL", __func__);
- return QDF_STATUS_E_NOMEM;
- }
-
ret = hif_snoc_get_target_type(ol_sc, dev, bdev, bid,
&hif_type, &target_type);
if (ret < 0) {