Browse Source

qcacld-3.0: Avoid NULL checking result of & operation

In LIM there are two separate places where the code iterates over the
gpSession[] array and tests each &mac_ctx->lim.gpSession[i] for NULL.
These NULL checks are unnecessary, so remove them.

Change-Id: Ice7435b19cc9fc61ebe11537e0aa6acd1b61984d
CRs-Fixed: 2419289
Jeff Johnson 6 years ago
parent
commit
eac5aadbc9

+ 4 - 5
core/mac/src/pe/lim/lim_process_assoc_req_frame.c

@@ -144,14 +144,13 @@ static QDF_STATUS lim_check_sta_in_pe_entries(struct mac_context *mac_ctx,
 	uint8_t i;
 	uint16_t assoc_id = 0;
 	tpDphHashNode sta_ds = NULL;
-	struct pe_session *session = NULL;
+	struct pe_session *session;
 
 	*dup_entry = false;
 	for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
-		if ((&mac_ctx->lim.gpSession[i] != NULL) &&
-		    (mac_ctx->lim.gpSession[i].valid) &&
-		    (mac_ctx->lim.gpSession[i].pePersona == QDF_SAP_MODE)) {
-			session = &mac_ctx->lim.gpSession[i];
+		session = &mac_ctx->lim.gpSession[i];
+		if (session->valid &&
+		    (session->pePersona == QDF_SAP_MODE)) {
 			sta_ds = dph_lookup_hash_entry(mac_ctx, hdr->sa,
 					&assoc_id, &session->dph.dphHashTable);
 			if (sta_ds

+ 3 - 5
core/mac/src/pe/lim/lim_send_sme_rsp_messages.c

@@ -662,12 +662,10 @@ void lim_send_sme_disassoc_ntf(struct mac_context *mac,
 			MAC_ADDR_ARRAY(peerMacAddr));
 
 		for (i = 0; i < mac->lim.maxBssId; i++) {
-			if ((&mac->lim.gpSession[i] != NULL) &&
-					(mac->lim.gpSession[i].valid) &&
-					(mac->lim.gpSession[i].pePersona ==
-								QDF_SAP_MODE)) {
+			session = &mac->lim.gpSession[i];
+			if (session->valid &&
+			    (session->pePersona == QDF_SAP_MODE)) {
 				/* Find the sta ds entry in another session */
-				session = &mac->lim.gpSession[i];
 				sta_ds = dph_lookup_hash_entry(mac,
 						peerMacAddr, &assoc_id,
 						&session->dph.dphHashTable);