Browse Source

qcacld-3.0: Cleanup mac_open()

mac_open() employs a completely superfluous inner block scope. Remove
it, and clean up a few other style issues.

Change-Id: I1ded0d462b9030fa49141c21d1b662543f9bced4
CRs-Fixed: 2313406
Dustin Brown 6 years ago
parent
commit
bf0e950ff1
1 changed files with 21 additions and 24 deletions
  1. 21 24
      core/mac/src/sys/legacy/src/system/src/mac_init_api.c

+ 21 - 24
core/mac/src/sys/legacy/src/system/src/mac_init_api.c

@@ -115,16 +115,13 @@ QDF_STATUS mac_open(struct wlan_objmgr_psoc *psoc, tHalHandle *pHalHandle,
 	QDF_STATUS status;
 	struct wlan_mlme_psoc_obj *mlme_obj;
 
-	if (pHalHandle == NULL)
+	QDF_BUG(pHalHandle);
+	if (!pHalHandle)
 		return QDF_STATUS_E_FAILURE;
 
 	p_mac = mac_allocate_context_buffer();
-
-	if (!p_mac) {
-		pe_err("%s: Failed to allocate %zu bytes for global_mac_context",
-		       __func__, sizeof(tAniSirGlobal));
+	if (!p_mac)
 		return QDF_STATUS_E_NOMEM;
-	}
 
 	/*
 	 * Set various global fields of p_mac here
@@ -148,34 +145,34 @@ QDF_STATUS mac_open(struct wlan_objmgr_psoc *psoc, tHalHandle *pHalHandle,
 	}
 	p_mac->mlme_cfg = &mlme_obj->cfg;
 
-	*pHalHandle = (tHalHandle) p_mac;
-
-	{
-		/*
-		 * For Non-FTM cases this value will be reset during mac_start
-		 */
-		if (cds_cfg->driver_type)
-			p_mac->gDriverType = QDF_DRIVER_TYPE_MFG;
+	*pHalHandle = (tHalHandle)p_mac;
 
-		/* Call routine to initialize CFG data structures */
-		if (QDF_STATUS_SUCCESS != cfg_init(p_mac)) {
-			status = QDF_STATUS_E_FAILURE;
-			goto release_psoc_ref;
-		}
+	/* For Non-FTM cases this value will be reset during mac_start */
+	if (cds_cfg->driver_type)
+		p_mac->gDriverType = QDF_DRIVER_TYPE_MFG;
 
-		sys_init_globals(p_mac);
+	status = cfg_init(p_mac);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		pe_err("failed to init legacy CFG; status:%u", status);
+		goto release_psoc_ref;
 	}
 
+	sys_init_globals(p_mac);
+
 	/* FW: 0 to 2047 and Host: 2048 to 4095 */
 	p_mac->mgmtSeqNum = WLAN_HOST_SEQ_NUM_MIN - 1;
 	p_mac->he_sgi_ltf_cfg_bit_mask = DEF_HE_AUTO_SGI_LTF;
 	p_mac->is_usr_cfg_amsdu_enabled = true;
 
-	status =  pe_open(p_mac, cds_cfg);
-	if (QDF_IS_STATUS_SUCCESS(status))
-		return status;
+	status = pe_open(p_mac, cds_cfg);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		pe_err("failed to open PE; status:%u", status);
+		goto deinit_cfg;
+	}
+
+	return QDF_STATUS_SUCCESS;
 
-	pe_err("pe_open() failure");
+deinit_cfg:
 	cfg_de_init(p_mac);
 
 release_psoc_ref: