qcacmn: Use QDF_STATUS instead of Linux return type in wmi layer

Replace Linux return type with QDF_STATUS to have uniformity
across common wmi layer.

Change-Id: I74730602c6b20fb240182afd7c6e5ec6b3fcfd55
CRs-Fixed: 987362
diff --git a/wmi_unified.c b/wmi_unified.c
index f437092..3fe6a5d 100644
--- a/wmi_unified.c
+++ b/wmi_unified.c
@@ -865,7 +865,7 @@
 		QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR,
 				  "%s: Target is suspended", __func__);
 		QDF_ASSERT(0);
-		return -EBUSY;
+		return QDF_STATUS_E_BUSY;
 	}
 
 	/* Do sanity check on the TLV parameter structure */
@@ -877,7 +877,7 @@
 			QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR,
 			"\nERROR: %s: Invalid WMI Param Buffer for Cmd:%d",
 				__func__, cmd_id);
-			return -EINVAL;
+			return QDF_STATUS_E_INVAL;
 		}
 	}
 
@@ -885,7 +885,7 @@
 		QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR,
 			 "%s, Failed to send cmd %x, no memory",
 			 __func__, cmd_id);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	WMI_SET_FIELD(qdf_nbuf_data(buf), WMI_CMD_HDR, COMMANDID, cmd_id);
@@ -900,7 +900,7 @@
 		QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR,
 		    "%s: MAX 1024 WMI Pending cmds reached.", __func__);
 		QDF_BUG(0);
-		return -EBUSY;
+		return QDF_STATUS_E_BUSY;
 	}
 
 	pkt = qdf_mem_malloc(sizeof(*pkt));
@@ -909,7 +909,7 @@
 		QDF_TRACE(QDF_MODULE_ID_WMI, QDF_TRACE_LEVEL_ERROR,
 			 "%s, Failed to alloc htc packet %x, no memory",
 			 __func__, cmd_id);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	SET_HTC_PACKET_INFO_TX(pkt,
diff --git a/wmi_unified_tlv.c b/wmi_unified_tlv.c
index 9286457..2d7b5df 100644
--- a/wmi_unified_tlv.c
+++ b/wmi_unified_tlv.c
@@ -48,12 +48,12 @@
 	wmi_vdev_create_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
 	int32_t len = sizeof(*cmd);
-	int32_t ret;
+	QDF_STATUS ret;
 
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGP("%s:wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_vdev_create_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -69,7 +69,7 @@
 		 macaddr[0], macaddr[1], macaddr[2],
 		 macaddr[3], macaddr[4], macaddr[5]);
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_VDEV_CREATE_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send WMI_VDEV_CREATE_CMDID");
 		wmi_buf_free(buf);
 	}
@@ -89,12 +89,12 @@
 {
 	wmi_vdev_delete_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
-	int32_t ret;
+	QDF_STATUS ret;
 
 	buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
 	if (!buf) {
 		WMI_LOGP("%s:wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	cmd = (wmi_vdev_delete_cmd_fixed_param *) wmi_buf_data(buf);
@@ -106,7 +106,7 @@
 	ret = wmi_unified_cmd_send(wmi_handle, buf,
 				   sizeof(wmi_vdev_delete_cmd_fixed_param),
 				   WMI_VDEV_DELETE_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send WMI_VDEV_DELETE_CMDID");
 		wmi_buf_free(buf);
 	}
@@ -132,7 +132,7 @@
 	buf = wmi_buf_alloc(wmi, len);
 	if (!buf) {
 		WMI_LOGP("%s : wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_vdev_stop_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -142,7 +142,7 @@
 	if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_STOP_CMDID)) {
 		WMI_LOGP("%s: Failed to send vdev stop command", __func__);
 		qdf_nbuf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	return 0;
@@ -164,7 +164,7 @@
 	buf = wmi_buf_alloc(wmi, len);
 	if (!buf) {
 		WMI_LOGP("%s : wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_vdev_down_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -174,7 +174,7 @@
 	if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_DOWN_CMDID)) {
 		WMI_LOGP("%s: Failed to send vdev down", __func__);
 		qdf_nbuf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 	WMI_LOGD("%s: vdev_id %d", __func__, vdev_id);
 
@@ -308,7 +308,7 @@
 	wmi_channel *chan;
 	int32_t len;
 	uint8_t *buf_ptr;
-	int32_t ret = 0;
+	QDF_STATUS ret = 0;
 
 	len = sizeof(*cmd) + sizeof(wmi_channel) + WMI_TLV_HDR_SIZE;
 	buf = wmi_buf_alloc(wmi_handle, len);
@@ -356,7 +356,7 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_VDEV_RESTART_REQUEST_CMDID);
-	if (ret < 0) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		wmi_buf_free(buf);
 		return QDF_STATUS_E_FAILURE;
 	}
@@ -383,7 +383,7 @@
 	buf = wmi_buf_alloc(wmi, len);
 	if (!buf) {
 		WMI_LOGP("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_peer_flush_tids_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -399,7 +399,7 @@
 	if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_FLUSH_TIDS_CMDID)) {
 		WMI_LOGP("%s: Failed to send flush tid command", __func__);
 		qdf_nbuf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	return 0;
@@ -423,7 +423,7 @@
 	buf = wmi_buf_alloc(wmi, len);
 	if (!buf) {
 		WMI_LOGP("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_peer_delete_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -436,7 +436,7 @@
 	if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_DELETE_CMDID)) {
 		WMI_LOGP("%s: Failed to send peer delete command", __func__);
 		qdf_nbuf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 	WMI_LOGD("%s: peer_addr %pM vdev_id %d", __func__, peer_addr, vdev_id);
 
@@ -462,7 +462,7 @@
 	buf = wmi_buf_alloc(wmi, sizeof(*cmd));
 	if (!buf) {
 		WMI_LOGE("Failed to allocate buffer to send set_param cmd");
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -479,7 +479,7 @@
 	if (err) {
 		WMI_LOGE("Failed to send set_param cmd");
 		qdf_mem_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	return 0;
@@ -507,7 +507,7 @@
 	buf = wmi_buf_alloc(wmi, len);
 	if (!buf) {
 		WMI_LOGP("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -519,7 +519,7 @@
 	if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) {
 		WMI_LOGP("%s: Failed to send vdev up command", __func__);
 		qdf_nbuf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	return 0;
@@ -544,7 +544,7 @@
 	buf = wmi_buf_alloc(wmi, len);
 	if (!buf) {
 		WMI_LOGP("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -558,7 +558,7 @@
 	if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) {
 		WMI_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__);
 		qdf_nbuf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 	WMI_LOGD("%s: peer_addr %pM vdev_id %d", __func__, param->peer_addr,
 			param->vdev_id);
@@ -586,7 +586,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGP("%s: Green AP PS Mem Alloc Failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf);
@@ -601,7 +601,7 @@
 				 WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) {
 		WMI_LOGE("Set Green AP PS param Failed val %d", value);
 		qdf_nbuf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	return 0;
@@ -622,7 +622,7 @@
 {
 	wmi_buf_t buf;
 	uint8_t *cmd;
-	int32_t ret = 0;
+	QDF_STATUS ret;
 	static uint8_t msgref = 1;
 	uint8_t segNumber = 0, segInfo, numSegments;
 	uint16_t chunk_len, total_bytes;
@@ -649,7 +649,7 @@
 				     WMI_TLV_HDR_SIZE));
 		if (!buf) {
 			WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
-			return -ENOMEM;
+			return QDF_STATUS_E_NOMEM;
 		}
 
 		cmd = (uint8_t *) wmi_buf_data(buf);
@@ -682,7 +682,7 @@
 					    WMI_TLV_HDR_SIZE),
 					   WMI_PDEV_UTF_CMDID);
 
-		if (ret != EOK) {
+		if (QDF_IS_STATUS_ERROR(ret)) {
 			WMI_LOGE("Failed to send WMI_PDEV_UTF_CMDID command");
 			wmi_buf_free(buf);
 			break;
@@ -710,7 +710,7 @@
 			   struct pdev_params *param,
 				uint8_t mac_id)
 {
-	int32_t ret;
+	QDF_STATUS ret;
 	wmi_pdev_set_param_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
 	uint16_t len = sizeof(*cmd);
@@ -718,7 +718,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_pdev_set_param_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -732,7 +732,7 @@
 				param->param_value);
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_PDEV_SET_PARAM_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send set param command ret = %d", ret);
 		wmi_buf_free(buf);
 	}
@@ -763,7 +763,7 @@
 	 */
 	wmibuf = wmi_buf_alloc(wmi_handle, len);
 	if (wmibuf == NULL)
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 
 	cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -796,11 +796,11 @@
 {
 	wmi_buf_t wmibuf;
 	wmi_pdev_resume_cmd_fixed_param *cmd;
-	int32_t ret;
+	QDF_STATUS ret;
 
 	wmibuf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
 	if (wmibuf == NULL)
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
 		       WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param,
@@ -809,7 +809,7 @@
 	cmd->reserved0 = 0;
 	ret = wmi_unified_cmd_send(wmi_handle, wmibuf, sizeof(*cmd),
 				   WMI_PDEV_RESUME_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command");
 		wmi_buf_free(wmibuf);
 	}
@@ -883,7 +883,7 @@
 	buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
 	if (!buf) {
 		WMI_LOGE("Failed to allocate buffer to send set_ap_ps_param cmd");
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_ap_ps_peer_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -899,7 +899,7 @@
 	if (err) {
 		WMI_LOGE("Failed to send set_ap_ps_param cmd");
 		qdf_mem_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	return 0;
@@ -923,7 +923,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGP("%s: Set Sta Ps param Mem Alloc Failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	cmd = (wmi_sta_powersave_param_cmd_fixed_param *) wmi_buf_data(buf);
@@ -940,7 +940,7 @@
 		WMI_LOGE("Set Sta Ps param Failed vdevId %d Param %d val %d",
 			 param->vdev_id, param->param, param->value);
 		qdf_nbuf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	return 0;
@@ -964,7 +964,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE("%s: wmi_buf_alloc failed!", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf);
@@ -1059,7 +1059,7 @@
 QDF_STATUS send_vdev_set_param_cmd_tlv(wmi_unified_t wmi_handle,
 				struct vdev_set_params *param)
 {
-	int32_t ret;
+	QDF_STATUS ret;
 	wmi_vdev_set_param_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
 	uint16_t len = sizeof(*cmd);
@@ -1067,7 +1067,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -1081,7 +1081,7 @@
 		 param->if_id, param->param_id, param->param_value);
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_VDEV_SET_PARAM_CMDID);
-	if (ret < 0) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send set param command ret = %d", ret);
 		wmi_buf_free(buf);
 	}
@@ -1167,7 +1167,7 @@
 	wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len);
 	if (!wmi_buf) {
 		WMI_LOGE("%s : wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf);
 	cmd = (wmi_bcn_tmpl_cmd_fixed_param *) buf_ptr;
@@ -1215,7 +1215,7 @@
 	wmi_buf_t buf;
 	int32_t len;
 	uint8_t *buf_ptr;
-	int ret;
+	QDF_STATUS ret;
 	uint32_t peer_legacy_rates_align;
 	uint32_t peer_ht_rates_align;
 
@@ -1232,7 +1232,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	buf_ptr = (uint8_t *) wmi_buf_data(buf);
@@ -1302,7 +1302,7 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_PEER_ASSOC_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGP("%s: Failed to send peer assoc command ret = %d",
 			 __func__, ret);
 		qdf_nbuf_free(buf);
@@ -1460,7 +1460,7 @@
 	if (!wmi_buf) {
 		WMI_LOGP("%s: failed to allocate memory for stop scan cmd",
 			 __func__);
-		ret = -ENOMEM;
+		ret = QDF_STATUS_E_NOMEM;
 		goto error;
 	}
 
@@ -1495,9 +1495,9 @@
 				struct scan_chan_list_params *chan_list)
 {
 	wmi_buf_t buf;
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
+	QDF_STATUS qdf_status;
 	wmi_scan_chan_list_cmd_fixed_param *cmd;
-	int status, i;
+	int i;
 	uint8_t *buf_ptr;
 	wmi_channel *chan_info, *tchan_info;
 	uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
@@ -1547,14 +1547,14 @@
 		chan_info++;
 	}
 
-	status = wmi_unified_cmd_send(wmi_handle, buf, len,
+	qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len,
 				      WMI_SCAN_CHAN_LIST_CMDID);
 
-	if (status != EOK) {
-		qdf_status = QDF_STATUS_E_FAILURE;
+	if (QDF_IS_STATUS_ERROR(qdf_status)) {
 		WMI_LOGE("Failed to send WMI_SCAN_CHAN_LIST_CMDID");
 		wmi_buf_free(buf);
 	}
+
 end:
 	return qdf_status;
 }
@@ -1644,7 +1644,7 @@
 QDF_STATUS send_modem_power_state_cmd_tlv(wmi_unified_t wmi_handle,
 		uint32_t param_value)
 {
-	int ret;
+	QDF_STATUS ret;
 	wmi_modem_power_state_cmd_param *cmd;
 	wmi_buf_t buf;
 	uint16_t len = sizeof(*cmd);
@@ -1652,7 +1652,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_modem_power_state_cmd_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -1664,10 +1664,11 @@
 		 param_value);
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				     WMI_MODEM_POWER_STATE_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send notify cmd ret = %d", ret);
 		wmi_buf_free(buf);
 	}
+
 	return ret;
 }
 
@@ -1691,7 +1692,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGP("%s: Set Sta Mode Ps Mem Alloc Failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_sta_powersave_mode_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -1709,7 +1710,7 @@
 		WMI_LOGE("Set Sta Mode Ps Failed vdevId %d val %d",
 			 vdev_id, val);
 		qdf_nbuf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 	return 0;
 }
@@ -1725,7 +1726,7 @@
 QDF_STATUS send_set_mimops_cmd_tlv(wmi_unified_t wmi_handle,
 			uint8_t vdev_id, int value)
 {
-	int ret = QDF_STATUS_SUCCESS;
+	QDF_STATUS ret;
 	wmi_sta_smps_force_mode_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
 	uint16_t len = sizeof(*cmd);
@@ -1733,7 +1734,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_sta_smps_force_mode_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -1765,7 +1766,7 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_STA_SMPS_FORCE_MODE_CMDID);
-	if (ret < 0) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send set Mimo PS ret = %d", ret);
 		wmi_buf_free(buf);
 	}
@@ -1784,7 +1785,7 @@
 QDF_STATUS send_set_smps_params_cmd_tlv(wmi_unified_t wmi_handle, uint8_t vdev_id,
 			       int value)
 {
-	int ret = QDF_STATUS_SUCCESS;
+	QDF_STATUS ret;
 	wmi_sta_smps_param_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
 	uint16_t len = sizeof(*cmd);
@@ -1792,7 +1793,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_sta_smps_param_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -1810,7 +1811,7 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_STA_SMPS_PARAM_CMDID);
-	if (ret < 0) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send set Mimo PS ret = %d", ret);
 		wmi_buf_free(buf);
 	}
@@ -1833,7 +1834,7 @@
 	wmi_buf_t buf;
 	uint8_t *buf_ptr;
 	uint16_t len;
-	int32_t status;
+	QDF_STATUS status;
 	uint32_t duration;
 
 	WMI_LOGD("%s: Enter", __func__);
@@ -1875,7 +1876,7 @@
 		 noa->interval);
 	status = wmi_unified_cmd_send(wmi_handle, buf, len,
 				      WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("Failed to send WMI_FWTEST_P2P_SET_NOA_PARAM_CMDID");
 		wmi_buf_free(buf);
 	}
@@ -1898,7 +1899,7 @@
 {
 	wmi_p2p_set_oppps_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
-	int32_t status;
+	QDF_STATUS status;
 
 	WMI_LOGD("%s: Enter", __func__);
 	buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
@@ -1922,7 +1923,7 @@
 		 cmd->vdev_id, oppps->ctwindow);
 	status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd),
 				      WMI_P2P_SET_OPPPS_PARAM_CMDID);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("Failed to send WMI_P2P_SET_OPPPS_PARAM_CMDID");
 		wmi_buf_free(buf);
 	}
@@ -1994,7 +1995,7 @@
 				struct sta_uapsd_trig_params *param)
 {
 	wmi_sta_uapsd_auto_trig_cmd_fixed_param *cmd;
-	int32_t ret;
+	QDF_STATUS ret;
 	uint32_t param_len = param->num_ac * sizeof(wmi_sta_uapsd_auto_trig_param);
 	uint32_t cmd_len = sizeof(*cmd) + param_len + WMI_TLV_HDR_SIZE;
 	uint32_t i;
@@ -2004,7 +2005,7 @@
 	buf = wmi_buf_alloc(wmi_handle, cmd_len);
 	if (!buf) {
 		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	buf_ptr = (uint8_t *) wmi_buf_data(buf);
@@ -2038,7 +2039,7 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, cmd_len,
 				   WMI_STA_UAPSD_AUTO_TRIG_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send set uapsd param ret = %d", ret);
 		wmi_buf_free(buf);
 	}
@@ -2056,7 +2057,7 @@
 QDF_STATUS send_ocb_set_utc_time_cmd_tlv(wmi_unified_t wmi_handle,
 				struct ocb_utc_param *utc)
 {
-	int32_t ret;
+	QDF_STATUS ret;
 	wmi_ocb_set_utc_time_cmd_fixed_param *cmd;
 	uint8_t *buf_ptr;
 	uint32_t len, i;
@@ -2066,7 +2067,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE(FL("wmi_buf_alloc failed"));
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	buf_ptr = (uint8_t *)wmi_buf_data(buf);
@@ -2084,13 +2085,12 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_OCB_SET_UTC_TIME_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE(FL("Failed to set OCB UTC time"));
 		wmi_buf_free(buf);
-		return -EIO;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return ret;
 }
 
 /**
@@ -2104,7 +2104,7 @@
 QDF_STATUS send_ocb_start_timing_advert_cmd_tlv(wmi_unified_t wmi_handle,
 	struct ocb_timing_advert_param *timing_advert)
 {
-	int32_t ret;
+	QDF_STATUS ret;
 	wmi_ocb_start_timing_advert_cmd_fixed_param *cmd;
 	uint8_t *buf_ptr;
 	uint32_t len, len_template;
@@ -2122,7 +2122,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE(FL("wmi_buf_alloc failed"));
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	buf_ptr = (uint8_t *)wmi_buf_data(buf);
@@ -2148,13 +2148,12 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_OCB_START_TIMING_ADVERT_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE(FL("Failed to start OCB timing advert"));
 		wmi_buf_free(buf);
-		return -EIO;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return ret;
 }
 
 /**
@@ -2168,7 +2167,7 @@
 QDF_STATUS send_ocb_stop_timing_advert_cmd_tlv(wmi_unified_t wmi_handle,
 	struct ocb_timing_advert_param *timing_advert)
 {
-	int32_t ret;
+	QDF_STATUS ret;
 	wmi_ocb_stop_timing_advert_cmd_fixed_param *cmd;
 	uint8_t *buf_ptr;
 	uint32_t len;
@@ -2178,7 +2177,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE(FL("wmi_buf_alloc failed"));
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	buf_ptr = (uint8_t *)wmi_buf_data(buf);
@@ -2192,13 +2191,12 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_OCB_STOP_TIMING_ADVERT_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE(FL("Failed to stop OCB timing advert"));
 		wmi_buf_free(buf);
-		return -EIO;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return ret;
 }
 
 /**
@@ -2221,7 +2219,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE(FL("wmi_buf_alloc failed"));
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	buf_ptr = (uint8_t *)wmi_buf_data(buf);
 
@@ -2237,13 +2235,12 @@
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_OCB_GET_TSF_TIMER_CMDID);
 	/* If there is an error, set the completion event */
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE(FL("Failed to send WMI message: %d"), ret);
 		wmi_buf_free(buf);
-		return -EIO;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return ret;
 }
 
 /**
@@ -2256,7 +2253,7 @@
 QDF_STATUS send_dcc_get_stats_cmd_tlv(wmi_unified_t wmi_handle,
 		     struct dcc_get_stats_param *get_stats_param)
 {
-	int32_t ret;
+	QDF_STATUS ret;
 	wmi_dcc_get_stats_cmd_fixed_param *cmd;
 	wmi_dcc_channel_stats_request *channel_stats_array;
 	wmi_buf_t buf;
@@ -2268,7 +2265,7 @@
 	if (get_stats_param->request_array_len !=
 	    get_stats_param->channel_count * sizeof(*channel_stats_array)) {
 		WMI_LOGE(FL("Invalid parameter"));
-		return -EINVAL;
+		return QDF_STATUS_E_INVAL;
 	}
 
 	/* Allocate memory for the WMI command */
@@ -2312,13 +2309,12 @@
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_DCC_GET_STATS_CMDID);
 
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE(FL("Failed to send WMI message: %d"), ret);
 		wmi_buf_free(buf);
-		return -EIO;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return ret;
 }
 
 /**
@@ -2332,7 +2328,7 @@
 QDF_STATUS send_dcc_clear_stats_cmd_tlv(wmi_unified_t wmi_handle,
 				uint32_t vdev_id, uint32_t dcc_stats_bitmap)
 {
-	int32_t ret;
+	QDF_STATUS ret;
 	wmi_dcc_clear_stats_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
 	uint8_t *buf_ptr;
@@ -2344,7 +2340,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE(FL("wmi_buf_alloc failed"));
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	buf_ptr = wmi_buf_data(buf);
@@ -2363,13 +2359,12 @@
 	/* Send the WMI command */
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_DCC_CLEAR_STATS_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE(FL("Failed to send the WMI command"));
 		wmi_buf_free(buf);
-		return -EIO;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return ret;
 }
 
 /**
@@ -2418,7 +2413,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE(FL("wmi_buf_alloc failed"));
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	buf_ptr = wmi_buf_data(buf);
@@ -2469,13 +2464,12 @@
 	qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_DCC_UPDATE_NDL_CMDID);
 	/* If there is an error, set the completion event */
-	if (qdf_status) {
+	if (QDF_IS_STATUS_ERROR(qdf_status)) {
 		WMI_LOGE(FL("Failed to send WMI message: %d"), qdf_status);
 		wmi_buf_free(buf);
-		return -EIO;
 	}
 
-	return 0;
+	return qdf_status;
 }
 
 /**
@@ -2488,7 +2482,7 @@
 QDF_STATUS send_ocb_set_config_cmd_tlv(wmi_unified_t wmi_handle,
 				struct ocb_config_param *config, uint32_t *ch_mhz)
 {
-	int32_t ret;
+	QDF_STATUS ret;
 	wmi_ocb_set_config_cmd_fixed_param *cmd;
 	wmi_channel *chan;
 	wmi_ocb_channel *ocb_chan;
@@ -2512,7 +2506,7 @@
 			config->channel_count * sizeof(wmi_dcc_ndl_chan)) {
 			WMI_LOGE(FL("NDL channel is invalid. List len: %d"),
 				 config->dcc_ndl_chan_list_len);
-			return -EINVAL;
+			return QDF_STATUS_E_INVAL;
 		}
 
 		for (i = 0, ndl_chan = config->dcc_ndl_chan_list;
@@ -2526,7 +2520,7 @@
 				active_state_count *
 				sizeof(wmi_dcc_ndl_active_state_config)) {
 				WMI_LOGE(FL("NDL active state is invalid."));
-				return -EINVAL;
+				return QDF_STATUS_E_INVAL;
 			}
 		}
 	}
@@ -2546,7 +2540,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE(FL("wmi_buf_alloc failed"));
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	buf_ptr = (uint8_t *)wmi_buf_data(buf);
@@ -2677,13 +2671,12 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_OCB_SET_CONFIG_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to set OCB config");
 		wmi_buf_free(buf);
-		return -EIO;
 	}
 
-	return 0;
+	return ret;
 }
 
 /**
@@ -2698,7 +2691,7 @@
 QDF_STATUS send_set_enable_disable_mcc_adaptive_scheduler_cmd_tlv(
 		   wmi_unified_t wmi_handle, uint32_t mcc_adaptive_scheduler)
 {
-	int ret = -1;
+	QDF_STATUS ret;
 	wmi_buf_t buf = 0;
 	wmi_resmgr_adaptive_ocs_enable_disable_cmd_fixed_param *cmd = NULL;
 	uint16_t len =
@@ -2720,12 +2713,13 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_RESMGR_ADAPTIVE_OCS_ENABLE_DISABLE_CMDID);
-	if (ret) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGP("%s: Failed to send enable/disable MCC"
 			 " adaptive scheduler command", __func__);
 		qdf_nbuf_free(buf);
 	}
-	return QDF_STATUS_SUCCESS;
+
+	return ret;
 }
 
 /**
@@ -2743,7 +2737,7 @@
 QDF_STATUS send_set_mcc_channel_time_latency_cmd_tlv(wmi_unified_t wmi_handle,
 	uint32_t mcc_channel_freq, uint32_t mcc_channel_time_latency)
 {
-	int ret = -1;
+	QDF_STATUS ret;
 	wmi_buf_t buf = 0;
 	wmi_resmgr_set_chan_latency_cmd_fixed_param *cmdTL = NULL;
 	uint16_t len = 0;
@@ -2793,14 +2787,14 @@
 	qdf_mem_copy(buf_ptr, &chan_latency, sizeof(chan_latency));
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_RESMGR_SET_CHAN_LATENCY_CMDID);
-	if (ret) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("%s: Failed to send MCC Channel Time Latency command",
 			 __func__);
 		qdf_nbuf_free(buf);
 		QDF_ASSERT(0);
-		return QDF_STATUS_E_FAILURE;
 	}
-	return QDF_STATUS_SUCCESS;
+
+	return ret;
 }
 
 /**
@@ -2816,7 +2810,7 @@
 	uint32_t adapter_1_chan_freq,
 	uint32_t adapter_1_quota, uint32_t adapter_2_chan_freq)
 {
-	int ret = -1;
+	QDF_STATUS ret;
 	wmi_buf_t buf = 0;
 	uint16_t len = 0;
 	uint8_t *buf_ptr = NULL;
@@ -2879,13 +2873,13 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_RESMGR_SET_CHAN_TIME_QUOTA_CMDID);
-	if (ret) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send MCC Channel Time Quota command");
 		qdf_nbuf_free(buf);
 		QDF_ASSERT(0);
-		return QDF_STATUS_E_FAILURE;
 	}
-	return QDF_STATUS_SUCCESS;
+
+	return ret;
 }
 
 /**
@@ -2903,7 +2897,7 @@
 {
 	wmi_thermal_mgmt_cmd_fixed_param *cmd = NULL;
 	wmi_buf_t buf = NULL;
-	int status = 0;
+	QDF_STATUS status;
 	uint32_t len = 0;
 
 	len = sizeof(*cmd);
@@ -2930,13 +2924,12 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf, len,
 				      WMI_THERMAL_MGMT_CMDID);
-	if (status) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		qdf_nbuf_free(buf);
 		WMI_LOGE("%s:Failed to send thermal mgmt command", __func__);
-		return QDF_STATUS_E_FAILURE;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return status;
 }
 
 
@@ -2956,7 +2949,7 @@
 {
 	wmi_lro_info_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
-	int status;
+	QDF_STATUS status;
 
 
 	buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
@@ -3015,13 +3008,12 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 		 sizeof(*cmd), WMI_LRO_CONFIG_CMDID);
-	if (status) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		qdf_nbuf_free(buf);
 		WMI_LOGE("%s:Failed to send WMI_LRO_CONFIG_CMDID", __func__);
-		return QDF_STATUS_E_FAILURE;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return status;
 }
 
 /**
@@ -3058,7 +3050,7 @@
 	ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd),
 				      WMI_PDEV_SEND_BCN_CMDID);
 
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send WMI_PDEV_SEND_BCN_CMDID command");
 		wmi_buf_free(wmi_buf);
 	}
@@ -3134,6 +3126,7 @@
 	WMI_STA_KEEPALVE_ARP_RESPONSE *arp_rsp;
 	uint8_t *buf_ptr;
 	int len;
+	QDF_STATUS ret;
 
 	WMI_LOGD("%s: Enter", __func__);
 
@@ -3186,14 +3179,15 @@
 		cmd->method = WMI_STA_KEEPALIVE_METHOD_NULL_FRAME;
 	}
 
-	if (wmi_unified_cmd_send(wmi_handle, buf, len,
-				 WMI_STA_KEEPALIVE_CMDID)) {
+	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
+				 WMI_STA_KEEPALIVE_CMDID);
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to set KeepAlive");
 		qdf_nbuf_free(buf);
 	}
 
 	WMI_LOGD("%s: Exit", __func__);
-	return 0;
+	return ret;
 }
 
 /**
@@ -3215,7 +3209,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_vdev_set_gtx_params_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -3322,7 +3316,7 @@
 	wmi_buf_t wmi_buf;
 	uint32_t tmpl_len, tmpl_len_aligned, wmi_buf_len;
 	uint8_t *buf_ptr;
-	int ret;
+	QDF_STATUS ret;
 
 	WMI_LOGD(FL("Send probe response template for vdev %d"), vdev_id);
 
@@ -3336,13 +3330,13 @@
 	if (wmi_buf_len > WMI_BEACON_TX_BUFFER_SIZE) {
 		WMI_LOGE(FL("wmi_buf_len: %d > %d. Can't send wmi cmd"),
 		wmi_buf_len, WMI_BEACON_TX_BUFFER_SIZE);
-		return -EINVAL;
+		return QDF_STATUS_E_INVAL;
 	}
 
 	wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len);
 	if (!wmi_buf) {
 		WMI_LOGE(FL("wmi_buf_alloc failed"));
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf);
@@ -3369,7 +3363,7 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle,
 				   wmi_buf, wmi_buf_len, WMI_PRB_TMPL_CMDID);
-	if (ret) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE(FL("Failed to send PRB RSP tmpl: %d"), ret);
 		wmi_buf_free(wmi_buf);
 	}
@@ -3427,7 +3421,7 @@
 	uint8_t *buf_ptr;
 	uint32_t len;
 	uint8_t *key_data;
-	uint8_t status;
+	QDF_STATUS status;
 
 	len = sizeof(*cmd) + roundup(key_params->key_len, sizeof(uint32_t)) +
 	       WMI_TLV_HDR_SIZE;
@@ -3470,12 +3464,10 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf, len,
 					      WMI_VDEV_INSTALL_KEY_CMDID);
-	if (status) {
+	if (QDF_IS_STATUS_ERROR(status))
 		qdf_nbuf_free(buf);
-		return QDF_STATUS_E_FAILURE;
-	}
 
-	return QDF_STATUS_SUCCESS;
+	return status;
 }
 
 
@@ -3490,7 +3482,7 @@
 QDF_STATUS send_p2p_go_set_beacon_ie_cmd_tlv(wmi_unified_t wmi_handle,
 				    A_UINT32 vdev_id, uint8_t *p2p_ie)
 {
-	int ret;
+	QDF_STATUS ret;
 	wmi_p2p_go_set_beacon_ie_fixed_param *cmd;
 	wmi_buf_t wmi_buf;
 	uint32_t ie_len, ie_len_aligned, wmi_buf_len;
@@ -3508,7 +3500,7 @@
 	 */
 	if (ie_len > 251) {
 		WMI_LOGE("%s : invalid p2p ie length %u", __func__, ie_len);
-		return -EINVAL;
+		return QDF_STATUS_E_INVAL;
 	}
 
 	ie_len_aligned = roundup(ie_len, sizeof(A_UINT32));
@@ -3520,7 +3512,7 @@
 	wmi_buf = wmi_buf_alloc(wmi_handle, wmi_buf_len);
 	if (!wmi_buf) {
 		WMI_LOGE("%s : wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf);
@@ -3543,7 +3535,7 @@
 	ret = wmi_unified_cmd_send(wmi_handle,
 				   wmi_buf, wmi_buf_len,
 				   WMI_P2P_GO_SET_BEACON_IE);
-	if (ret) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send bcn tmpl: %d", ret);
 		wmi_buf_free(wmi_buf);
 	}
@@ -3567,7 +3559,7 @@
 {
 	wmi_roam_subnet_change_config_fixed_param *cmd;
 	wmi_buf_t buf;
-	int ret;
+	QDF_STATUS ret;
 	int len = sizeof(*cmd);
 
 	buf = wmi_buf_alloc(wmi_handle, len);
@@ -3601,14 +3593,13 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				WMI_ROAM_SUBNET_CHANGE_CONFIG_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send gw config parameter to fw, ret: %d",
 			ret);
 		wmi_buf_free(buf);
-		return QDF_STATUS_E_FAILURE;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return ret;
 }
 
 /**
@@ -3626,7 +3617,8 @@
 {
 	wmi_rssi_breach_monitor_config_fixed_param *cmd;
 	wmi_buf_t buf;
-	int ret, len = sizeof(*cmd);
+	QDF_STATUS ret;
+	uint32_t len = sizeof(*cmd);
 
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
@@ -3659,14 +3651,13 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID");
 		wmi_buf_free(buf);
-		return QDF_STATUS_E_FAILURE;
 	}
 
 	WMI_LOGI("Sent WMI_RSSI_BREACH_MONITOR_CONFIG_CMDID to FW");
-	return QDF_STATUS_SUCCESS;
+	return ret;
 }
 
 /**
@@ -3845,10 +3836,11 @@
 				      struct roam_offload_scan_params *roam_req)
 {
 	wmi_buf_t buf = NULL;
-	int status = 0;
+	QDF_STATUS status;
 	int len;
 	uint8_t *buf_ptr;
 	wmi_roam_scan_mode_fixed_param *roam_scan_mode_fp;
+
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 	int auth_mode = roam_req->auth_mode;
 	wmi_roam_offload_tlv_param *roam_offload_params;
@@ -4102,15 +4094,14 @@
 #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_ROAM_SCAN_MODE);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMA_LOGE(
 		    "wmi_unified_cmd_send WMI_ROAM_SCAN_MODE returned Error %d",
 			status);
 		wmi_buf_free(buf);
-		return QDF_STATUS_E_FAILURE;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return status;
 }
 
 
@@ -4128,7 +4119,7 @@
 				struct roam_offload_scan_rssi_params *roam_req)
 {
 	wmi_buf_t buf = NULL;
-	int status = 0;
+	QDF_STATUS status;
 	int len;
 	uint8_t *buf_ptr;
 	wmi_roam_scan_rssi_threshold_fixed_param *rssi_threshold_fp;
@@ -4207,14 +4198,13 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_ROAM_SCAN_RSSI_THRESHOLD);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMA_LOGE("cmd WMI_ROAM_SCAN_RSSI_THRESHOLD returned Error %d",
 					status);
 		wmi_buf_free(buf);
-		return QDF_STATUS_E_FAILURE;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return status;
 }
 
 /**
@@ -4233,7 +4223,8 @@
 				struct roam_scan_filter_params *roam_req)
 {
 	wmi_buf_t buf = NULL;
-	int status = 0, i;
+	QDF_STATUS status;
+	uint32_t i;
 	uint32_t len;
 	uint8_t *buf_ptr;
 	wmi_roam_filter_fixed_param *roam_filter;
@@ -4318,13 +4309,13 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 		len, WMI_ROAM_FILTER_CMDID);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMA_LOGE("cmd WMI_ROAM_FILTER_CMDID returned Error %d",
 				status);
 		wmi_buf_free(buf);
-		return QDF_STATUS_E_FAILURE;
 	}
-	return QDF_STATUS_SUCCESS;
+
+	return status;
 }
 
 /** send_set_epno_network_list_cmd_tlv() - set epno network list
@@ -4344,7 +4335,7 @@
 	u_int8_t i, *buf_ptr;
 	wmi_buf_t buf;
 	uint32_t len;
-	int ret;
+	QDF_STATUS ret;
 
 	/* TLV place holder for array of structures
 	 * nlo_configured_parameters(nlo_list) */
@@ -4424,16 +4415,15 @@
 	buf_ptr += WMI_TLV_HDR_SIZE;
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_NETWORK_LIST_OFFLOAD_CONFIG_CMDID);
-	if (ret) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("%s: Failed to send nlo wmi cmd", __func__);
 		wmi_buf_free(buf);
-		return QDF_STATUS_E_FAILURE;
 	}
 
 	WMI_LOGD("set ePNO list request sent successfully for vdev %d",
 		 req->session_id);
 
-	return QDF_STATUS_SUCCESS;
+	return ret;
 }
 
 /** send_ipa_offload_control_cmd_tlv() - ipa offload control parameter
@@ -5930,8 +5920,7 @@
 QDF_STATUS send_lphb_config_hbenable_cmd_tlv(wmi_unified_t wmi_handle,
 				wmi_hb_set_enable_cmd_fixed_param *params)
 {
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-	int status = 0;
+	QDF_STATUS status;
 	wmi_buf_t buf = NULL;
 	uint8_t *buf_ptr;
 	wmi_hb_set_enable_cmd_fixed_param *hb_enable_fp;
@@ -5959,16 +5948,13 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_HB_SET_ENABLE_CMDID);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_ENABLE returned Error %d",
 			status);
-		qdf_status = QDF_STATUS_E_FAILURE;
-		goto error;
+		wmi_buf_free(buf);
 	}
 
-	return QDF_STATUS_SUCCESS;
-error:
-	return qdf_status;
+	return status;
 }
 
 /**
@@ -5981,8 +5967,7 @@
 QDF_STATUS send_lphb_config_tcp_params_cmd_tlv(wmi_unified_t wmi_handle,
 	    wmi_hb_set_tcp_params_cmd_fixed_param *lphb_conf_req)
 {
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-	int status = 0;
+	QDF_STATUS status;
 	wmi_buf_t buf = NULL;
 	uint8_t *buf_ptr;
 	wmi_hb_set_tcp_params_cmd_fixed_param *hb_tcp_params_fp;
@@ -6017,16 +6002,12 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_HB_SET_TCP_PARAMS_CMDID);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_TCP_PARAMS returned Error %d",
 			status);
-		qdf_status = QDF_STATUS_E_FAILURE;
-		goto error;
 	}
 
-	return QDF_STATUS_SUCCESS;
-error:
-	return qdf_status;
+	return status;
 }
 
 /**
@@ -6039,8 +6020,7 @@
 QDF_STATUS send_lphb_config_tcp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle,
 		wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *g_hb_tcp_filter_fp)
 {
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-	int status = 0;
+	QDF_STATUS status;
 	wmi_buf_t buf = NULL;
 	uint8_t *buf_ptr;
 	wmi_hb_set_tcp_pkt_filter_cmd_fixed_param *hb_tcp_filter_fp;
@@ -6071,16 +6051,12 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_HB_SET_TCP_PKT_FILTER_CMDID);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_TCP_PKT_FILTER returned Error %d",
 			status);
-		qdf_status = QDF_STATUS_E_FAILURE;
-		goto error;
 	}
 
-	return QDF_STATUS_SUCCESS;
-error:
-	return qdf_status;
+	return status;
 }
 
 /**
@@ -6093,8 +6069,7 @@
 QDF_STATUS send_lphb_config_udp_params_cmd_tlv(wmi_unified_t wmi_handle,
 		   wmi_hb_set_udp_params_cmd_fixed_param *lphb_conf_req)
 {
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-	int status = 0;
+	QDF_STATUS status;
 	wmi_buf_t buf = NULL;
 	uint8_t *buf_ptr;
 	wmi_hb_set_udp_params_cmd_fixed_param *hb_udp_params_fp;
@@ -6128,16 +6103,11 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_HB_SET_UDP_PARAMS_CMDID);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status))
 		WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_UDP_PARAMS returned Error %d",
 			status);
-		qdf_status = QDF_STATUS_E_FAILURE;
-		goto error;
-	}
 
-	return QDF_STATUS_SUCCESS;
-error:
-	return qdf_status;
+	return status;
 }
 
 /**
@@ -6150,8 +6120,7 @@
 QDF_STATUS send_lphb_config_udp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle,
 		wmi_hb_set_udp_pkt_filter_cmd_fixed_param *lphb_conf_req)
 {
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
-	int status = 0;
+	QDF_STATUS status;
 	wmi_buf_t buf = NULL;
 	uint8_t *buf_ptr;
 	wmi_hb_set_udp_pkt_filter_cmd_fixed_param *hb_udp_filter_fp;
@@ -6182,16 +6151,11 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_HB_SET_UDP_PKT_FILTER_CMDID);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status))
 		WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_UDP_PKT_FILTER returned Error %d",
 			status);
-		qdf_status = QDF_STATUS_E_FAILURE;
-		goto error;
-	}
 
-	return QDF_STATUS_SUCCESS;
-error:
-	return qdf_status;
+	return status;
 }
 #endif /* FEATURE_WLAN_LPHB */
 
@@ -6205,7 +6169,7 @@
 QDF_STATUS send_process_dhcp_ind_cmd_tlv(wmi_unified_t wmi_handle,
 				wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind)
 {
-	int status = 0;
+	QDF_STATUS status;
 	wmi_buf_t buf = NULL;
 	uint8_t *buf_ptr;
 	wmi_peer_set_param_cmd_fixed_param *peer_set_param_fp;
@@ -6235,13 +6199,11 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_PEER_SET_PARAM_CMDID);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status))
 		WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD"
 			 " returned Error %d", __func__, status);
-		return QDF_STATUS_E_FAILURE;
-	}
 
-	return QDF_STATUS_SUCCESS;
+	return status;
 }
 
 /**
@@ -6354,7 +6316,7 @@
 		buf = wmi_buf_alloc(wmi_handle, len);
 		if (!buf) {
 			WMI_LOGP("%s: wmi_buf_alloc Failed", __func__);
-			return -ENOMEM;
+			return QDF_STATUS_E_NOMEM;
 		}
 		prof_trig_cmd =
 			(wmi_wlan_profile_trigger_cmd_fixed_param *)
@@ -6379,7 +6341,7 @@
 		buf = wmi_buf_alloc(wmi_handle, len);
 		if (!buf) {
 			WMI_LOGP("%s: wmi_buf_alloc Failed", __func__);
-			return -ENOMEM;
+			return QDF_STATUS_E_NOMEM;
 		}
 		profile_getdata_cmd =
 			(wmi_wlan_profile_get_prof_data_cmd_fixed_param *)
@@ -6403,7 +6365,7 @@
 		buf = wmi_buf_alloc(wmi_handle, len);
 		if (!buf) {
 			WMI_LOGP("%s: wmi_buf_alloc Failed", __func__);
-			return -ENOMEM;
+			return QDF_STATUS_E_NOMEM;
 		}
 		hist_intvl_cmd =
 			(wmi_wlan_profile_set_hist_intvl_cmd_fixed_param *)
@@ -6430,7 +6392,7 @@
 		buf = wmi_buf_alloc(wmi_handle, len);
 		if (!buf) {
 			WMI_LOGP("%s: wmi_buf_alloc Failed", __func__);
-			return -ENOMEM;
+			return QDF_STATUS_E_NOMEM;
 		}
 		profile_enable_cmd =
 			(wmi_wlan_profile_enable_profile_id_cmd_fixed_param *)
@@ -6567,7 +6529,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGP("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (WMI_VDEV_IPSEC_NATKEEPALIVE_FILTER_CMD_fixed_param *)
 		wmi_buf_data(buf);
@@ -6582,7 +6544,7 @@
 		WMI_LOGP("%s: Failed to send NAT keepalive enable command",
 			 __func__);
 		wmi_buf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	return 0;
@@ -6606,7 +6568,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGP("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_csa_offload_enable_cmd_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -6620,7 +6582,7 @@
 		WMI_LOGP("%s: Failed to send CSA offload enable command",
 			 __func__);
 		wmi_buf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	return 0;
@@ -6639,7 +6601,7 @@
 {
 	wmi_buf_t buf;
 	uint8_t *cmd;
-	int ret = 0;
+	QDF_STATUS ret;
 
 	buf = wmi_buf_alloc(wmi_handle,
 			    (data_len + WMI_TLV_HDR_SIZE));
@@ -6662,13 +6624,12 @@
 				   (data_len +
 				    WMI_TLV_HDR_SIZE), WMI_OEM_REQ_CMDID);
 
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE(FL(":wmi cmd send failed"));
 		qdf_nbuf_free(buf);
-		return QDF_STATUS_E_FAILURE;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return ret;
 }
 
 /**
@@ -6691,7 +6652,7 @@
 	wmi_dfs_phyerr_filter_dis_cmd_fixed_param *disable_phyerr_offload_cmd;
 	wmi_buf_t buf;
 	uint16_t len;
-	int ret;
+	QDF_STATUS ret;
 
 
 	if (dfs_phyerr_filter_offload) {
@@ -6719,7 +6680,7 @@
 		 */
 		ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 					   WMI_DFS_PHYERR_FILTER_DIS_CMDID);
-		if (ret < 0) {
+		if (QDF_IS_STATUS_ERROR(ret)) {
 			WMI_LOGE("%s: Failed to send WMI_DFS_PHYERR_FILTER_DIS_CMDID ret=%d",
 				__func__, ret);
 			wmi_buf_free(buf);
@@ -6755,7 +6716,7 @@
 		ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 					   WMI_DFS_PHYERR_FILTER_ENA_CMDID);
 
-		if (ret < 0) {
+		if (QDF_IS_STATUS_ERROR(ret)) {
 			WMI_LOGE("%s: Failed to send DFS PHYERR CMD ret=%d",
 				__func__, ret);
 			wmi_buf_free(buf);
@@ -7288,7 +7249,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE("%s: Failed allocate wmi buffer", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	cmd = (WMI_PACKET_FILTER_ENABLE_CMD_fixed_param *) wmi_buf_data(buf);
@@ -7339,7 +7300,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE("Failed to allocate buffer to send set_param cmd");
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	cmd = (WMI_PACKET_FILTER_CONFIG_CMD_fixed_param *)wmi_buf_data(buf);
@@ -7388,7 +7349,7 @@
 	if (err) {
 		WMI_LOGE("Failed to send pkt_filter cmd");
 		wmi_buf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 
@@ -7416,7 +7377,7 @@
 	buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
 	if (!buf) {
 		WMI_LOGE("Failed to allocate buffer to send set_param cmd");
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	cmd = (WMI_SET_MCASTBCAST_FILTER_CMD_fixed_param *) wmi_buf_data(buf);
@@ -7436,7 +7397,7 @@
 	if (err) {
 		WMI_LOGE("Failed to send set_param cmd");
 		qdf_mem_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 	WMI_LOGD("Action:%d; vdev_id:%d; clearList:%d",
 		 cmd->action, vdev_id, clearList);
@@ -7679,7 +7640,7 @@
 QDF_STATUS send_stats_ext_req_cmd_tlv(wmi_unified_t wmi_handle,
 			struct stats_ext_params *preq)
 {
-	int32_t ret;
+	QDF_STATUS ret;
 	wmi_req_stats_ext_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
 	uint16_t len;
@@ -7690,7 +7651,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	buf_ptr = (uint8_t *) wmi_buf_data(buf);
@@ -7714,7 +7675,7 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_REQUEST_STATS_EXT_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("%s: Failed to send notify cmd ret = %d", __func__,
 			 ret);
 		wmi_buf_free(buf);
@@ -7917,7 +7878,7 @@
 QDF_STATUS send_set_auto_shutdown_timer_cmd_tlv(wmi_unified_t wmi_handle,
 						  uint32_t timer_val)
 {
-	int status = 0;
+	QDF_STATUS status;
 	wmi_buf_t buf = NULL;
 	uint8_t *buf_ptr;
 	wmi_host_auto_shutdown_cfg_cmd_fixed_param *wmi_auto_sh_cmd;
@@ -7944,14 +7905,13 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("%s: WMI_HOST_AUTO_SHUTDOWN_CFG_CMDID Err %d",
 			 __func__, status);
 		wmi_buf_free(buf);
-		return QDF_STATUS_E_FAILURE;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return status;
 }
 
 /**
@@ -7964,7 +7924,7 @@
 QDF_STATUS send_nan_req_cmd_tlv(wmi_unified_t wmi_handle,
 			struct nan_req_params *nan_req)
 {
-	int ret;
+	QDF_STATUS ret;
 	wmi_nan_cmd_param *cmd;
 	wmi_buf_t buf;
 	uint16_t len = sizeof(*cmd);
@@ -8005,7 +7965,7 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_NAN_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("%s Failed to send set param command ret = %d",
 			 __func__, ret);
 		wmi_buf_free(buf);
@@ -8026,13 +7986,13 @@
 {
 	wmi_set_dhcp_server_offload_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
-	int err;
+	QDF_STATUS status;
 
 	buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
 	if (!buf) {
 		WMI_LOGE("Failed to allocate buffer to send "
 			 "set_dhcp_server_offload cmd");
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	cmd = (wmi_set_dhcp_server_offload_cmd_fixed_param *) wmi_buf_data(buf);
@@ -8047,17 +8007,18 @@
 	cmd->num_client = pDhcpSrvOffloadInfo->dhcpClientNum;
 	cmd->srv_ipv4 = pDhcpSrvOffloadInfo->dhcpSrvIP;
 	cmd->start_lsb = 0;
-	err = wmi_unified_cmd_send(wmi_handle, buf,
+	status = wmi_unified_cmd_send(wmi_handle, buf,
 				   sizeof(*cmd),
 				   WMI_SET_DHCP_SERVER_OFFLOAD_CMDID);
-	if (err) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("Failed to send set_dhcp_server_offload cmd");
 		wmi_buf_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 	WMI_LOGD("Set dhcp server offload to vdevId %d",
 		 pDhcpSrvOffloadInfo->vdev_id);
-	return 0;
+
+	return status;
 }
 
 /**
@@ -8071,7 +8032,7 @@
 				struct flashing_req_params *flashing)
 {
 	wmi_set_led_flashing_cmd_fixed_param *cmd;
-	int status = 0;
+	QDF_STATUS status;
 	wmi_buf_t buf;
 	uint8_t *buf_ptr;
 	int32_t len = sizeof(wmi_set_led_flashing_cmd_fixed_param);
@@ -8079,7 +8040,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGP(FL("wmi_buf_alloc failed"));
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	buf_ptr = (uint8_t *) wmi_buf_data(buf);
 	cmd = (wmi_set_led_flashing_cmd_fixed_param *) buf_ptr;
@@ -8093,12 +8054,12 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf, len,
 				      WMI_PDEV_SET_LED_FLASHING_CMDID);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD"
 			 " returned Error %d", __func__, status);
-		return QDF_STATUS_E_FAILURE;
 	}
-	return QDF_STATUS_SUCCESS;
+
+	return status;
 }
 
 /**
@@ -8110,7 +8071,7 @@
  */
 QDF_STATUS send_process_ch_avoid_update_cmd_tlv(wmi_unified_t wmi_handle)
 {
-	int status = 0;
+	QDF_STATUS status;
 	wmi_buf_t buf = NULL;
 	uint8_t *buf_ptr;
 	wmi_chan_avoid_update_cmd_param *ch_avoid_update_fp;
@@ -8132,15 +8093,14 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_CHAN_AVOID_UPDATE_CMDID);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("wmi_unified_cmd_send"
 			 " WMITLV_TABLE_WMI_CHAN_AVOID_UPDATE"
 			 " returned Error %d", status);
 		wmi_buf_free(buf);
-		return QDF_STATUS_E_FAILURE;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return status;
 }
 
 /**
@@ -8618,7 +8578,7 @@
 	wmi_buf_t buf;
 	uint8_t *buf_ptr;
 	uint32_t len, ie_len_aligned;
-	int ret;
+	QDF_STATUS ret;
 
 
 	ie_len_aligned = roundup(ie_info->length, sizeof(uint32_t));
@@ -8656,7 +8616,7 @@
 
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_VDEV_SET_IE_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE(FL("Failed to send set IE command ret = %d"), ret);
 		wmi_buf_free(buf);
 	}
@@ -8976,7 +8936,7 @@
 	buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
 	if (!buf) {
 		WMI_LOGE("Failed to allocate buffer to send base macaddr cmd");
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	cmd = (wmi_pdev_set_base_macaddr_cmd_fixed_param *) wmi_buf_data(buf);
@@ -8993,7 +8953,7 @@
 	if (err) {
 		WMI_LOGE("Failed to send set_base_macaddr cmd");
 		qdf_mem_free(buf);
-		return -EIO;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	return 0;
@@ -9030,7 +8990,7 @@
 	param_buf = (WMI_DIAG_EVENT_LOG_SUPPORTED_EVENTID_param_tlvs *) event;
 	if (!param_buf) {
 		WMI_LOGE("Invalid log supported event buffer");
-		return -EINVAL;
+		return QDF_STATUS_E_INVAL;
 	}
 	wmi_event = param_buf->fixed_param;
 	num_of_diag_events_logs = wmi_event->num_of_diag_events_logs;
@@ -9038,7 +8998,7 @@
 	if (!evt_args) {
 		WMI_LOGE("%s: Event list is empty, num_of_diag_events_logs=%d",
 				__func__, num_of_diag_events_logs);
-		return -EINVAL;
+		return QDF_STATUS_E_INVAL;
 	}
 
 	WMI_LOGD("%s: num_of_diag_events_logs=%d",
@@ -9054,7 +9014,7 @@
 	if (!wmi_handle->events_logs_list) {
 		WMI_LOGE("%s: event log list memory allocation failed",
 				__func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	wmi_handle->num_of_diag_events_logs = num_of_diag_events_logs;
 
@@ -9067,7 +9027,7 @@
 		WMI_LOGE("%s: wmi_buf_alloc failed", __func__);
 		qdf_mem_free(wmi_handle->events_logs_list);
 		wmi_handle->events_logs_list = NULL;
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf);
@@ -9112,7 +9072,7 @@
 		/* Not clearing events_logs_list, though wmi cmd failed.
 		 * Host can still have this list
 		 */
-		return -EINVAL;
+		return QDF_STATUS_E_INVAL;
 	}
 
 	return 0;
@@ -9142,7 +9102,7 @@
 	if (!wmi_handle->events_logs_list) {
 		WMI_LOGE("%s: Not received event/log list from FW, yet",
 				__func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	/* total_len stores the number of events where BITS 17 and 18 are set.
 	 * i.e., events of high frequency (17) and for extended debugging (18)
@@ -9160,7 +9120,7 @@
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGE("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 	cmd = (wmi_diag_event_log_config_fixed_param *) wmi_buf_data(buf);
 	buf_ptr = (uint8_t *) cmd;
@@ -9206,7 +9166,7 @@
 		WMI_LOGE("%s: WMI_DIAG_EVENT_LOG_CONFIG_CMDID failed",
 				__func__);
 		wmi_buf_free(buf);
-		return -EINVAL;
+		return QDF_STATUS_E_INVAL;
 	}
 
 	return QDF_STATUS_SUCCESS;
@@ -9226,12 +9186,12 @@
 	wmi_debug_mesg_flush_fixed_param *cmd;
 	wmi_buf_t buf;
 	int len = sizeof(*cmd);
-	int ret;
+	QDF_STATUS ret;
 
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
 		WMI_LOGP("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
+		return QDF_STATUS_E_NOMEM;
 	}
 
 	cmd = (wmi_debug_mesg_flush_fixed_param *) wmi_buf_data(buf);
@@ -9245,14 +9205,14 @@
 			buf,
 			len,
 			WMI_DEBUG_MESG_FLUSH_CMDID);
-	if (ret != EOK) {
+	if (QDF_IS_STATUS_ERROR(ret)) {
 		WMI_LOGE("Failed to send WMI_DEBUG_MESG_FLUSH_CMDID");
 		wmi_buf_free(buf);
-		return -EINVAL;
+		return QDF_STATUS_E_INVAL;
 	}
 	WMI_LOGI("Sent WMI_DEBUG_MESG_FLUSH_CMDID to FW");
 
-	return QDF_STATUS_SUCCESS;
+	return ret;
 }
 
 /**
@@ -9864,10 +9824,9 @@
 QDF_STATUS send_roam_scan_offload_cmd_tlv(wmi_unified_t wmi_handle,
 					 uint32_t command, uint32_t vdev_id)
 {
-	QDF_STATUS qdf_status;
+	QDF_STATUS status;
 	wmi_roam_scan_cmd_fixed_param *cmd_fp;
 	wmi_buf_t buf = NULL;
-	int status = 0;
 	int len;
 	uint8_t *buf_ptr;
 
@@ -9889,10 +9848,9 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_ROAM_SCAN_CMD);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_SCAN_CMD returned Error %d",
 			status);
-		qdf_status = QDF_STATUS_E_FAILURE;
 		goto error;
 	}
 
@@ -9902,7 +9860,7 @@
 error:
 	wmi_buf_free(buf);
 
-	return qdf_status;
+	return status;
 }
 
 /**
@@ -9919,9 +9877,8 @@
 					    wmi_ap_profile *ap_profile_p,
 					    uint32_t vdev_id)
 {
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
 	wmi_buf_t buf = NULL;
-	int status = 0;
+	QDF_STATUS status;
 	int len;
 	uint8_t *buf_ptr;
 	wmi_roam_ap_profile_fixed_param *roam_ap_profile_fp;
@@ -9951,19 +9908,15 @@
 		       WMITLV_GET_STRUCT_TLVLEN(wmi_ap_profile));
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_ROAM_AP_PROFILE);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_AP_PROFILE returned Error %d",
 			status);
-		qdf_status = QDF_STATUS_E_FAILURE;
-		goto error;
+		wmi_buf_free(buf);
 	}
 
 	WMI_LOGI("WMI --> WMI_ROAM_AP_PROFILE and other parameters");
-	return QDF_STATUS_SUCCESS;
-error:
-	wmi_buf_free(buf);
 
-	return qdf_status;
+	return status;
 }
 
 /**
@@ -9982,9 +9935,8 @@
 					     uint32_t scan_age,
 					     uint32_t vdev_id)
 {
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
+	QDF_STATUS status;
 	wmi_buf_t buf = NULL;
-	int status = 0;
 	int len;
 	uint8_t *buf_ptr;
 	wmi_roam_scan_period_fixed_param *scan_period_fp;
@@ -10010,10 +9962,9 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_ROAM_SCAN_PERIOD);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_SCAN_PERIOD returned Error %d",
 			status);
-		qdf_status = QDF_STATUS_E_FAILURE;
 		goto error;
 	}
 
@@ -10023,7 +9974,7 @@
 error:
 	wmi_buf_free(buf);
 
-	return qdf_status;
+	return status;
 }
 
 /**
@@ -10043,9 +9994,8 @@
 				   uint8_t *chan_list,
 				   uint8_t list_type, uint32_t vdev_id)
 {
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
 	wmi_buf_t buf = NULL;
-	int status = 0;
+	QDF_STATUS status;
 	int len, list_tlv_len;
 	int i;
 	uint8_t *buf_ptr;
@@ -10097,10 +10047,9 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_ROAM_CHAN_LIST);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_CHAN_LIST returned Error %d",
 			status);
-		qdf_status = QDF_STATUS_E_FAILURE;
 		goto error;
 	}
 
@@ -10109,7 +10058,7 @@
 error:
 	wmi_buf_free(buf);
 
-	return qdf_status;
+	return status;
 }
 
 /**
@@ -10129,9 +10078,8 @@
 	uint32_t bcn_rssi_weight,
 	uint32_t hirssi_delay_btw_scans)
 {
-	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
 	wmi_buf_t buf = NULL;
-	int status = 0;
+	QDF_STATUS status;
 	int len;
 	uint8_t *buf_ptr;
 	wmi_roam_scan_rssi_change_threshold_fixed_param *rssi_change_fp;
@@ -10159,10 +10107,9 @@
 
 	status = wmi_unified_cmd_send(wmi_handle, buf,
 				      len, WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD);
-	if (status != EOK) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMI_LOGE("wmi_unified_cmd_send WMI_ROAM_SCAN_RSSI_CHANGE_THRESHOLD returned Error %d",
 			status);
-		qdf_status = QDF_STATUS_E_FAILURE;
 		goto error;
 	}
 
@@ -10173,7 +10120,7 @@
 error:
 	wmi_buf_free(buf);
 
-	return qdf_status;
+	return status;
 }
 
 /** wmi_get_hotlist_entries_per_page() - hotlist entries per page