Ver código fonte

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
Houston Hoffman 8 anos atrás
pai
commit
834b927a37
1 arquivos alterados com 6 adições e 5 exclusões
  1. 6 5
      hif/src/snoc/if_snoc.c

+ 6 - 5
hif/src/snoc/if_snoc.c

@@ -229,6 +229,12 @@ QDF_STATUS hif_snoc_enable_bus(struct hif_softc *ol_sc,
 	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 @@ QDF_STATUS hif_snoc_enable_bus(struct hif_softc *ol_sc,
 		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) {