Просмотр исходного кода

qcacld-3.0: tdls: Replace explicit comparison to NULL

Per the Linux Kernel coding style, as enforced by the kernel
checkpatch script, pointers should not be explicitly compared to
NULL. Therefore within tdls replace any such comparisons with logical
operations performed on the pointer itself.

Change-Id: I836dec2b71e0c11f11b18402c7b127bb4ccbba48
CRs-Fixed: 2418394
Jeff Johnson 6 лет назад
Родитель
Сommit
bdc473f2f4

+ 3 - 3
components/tdls/core/src/wlan_tdls_cmds_process.c

@@ -622,7 +622,7 @@ int tdls_set_cap(struct tdls_vdev_priv_obj *tdls_vdev, const uint8_t *mac,
 	struct tdls_peer *curr_peer;
 
 	curr_peer = tdls_get_peer(tdls_vdev, mac);
-	if (curr_peer == NULL) {
+	if (!curr_peer) {
 		tdls_err("curr_peer is NULL");
 		return -EINVAL;
 	}
@@ -716,7 +716,7 @@ int tdls_validate_mgmt_request(struct tdls_action_frame_request *tdls_mgmt_req)
 	}
 
 	if (TDLS_IS_SETUP_ACTION(tdls_validate->action_code)) {
-		if (NULL != tdls_is_progress(tdls_vdev,
+		if (tdls_is_progress(tdls_vdev,
 			tdls_validate->peer_mac, true)) {
 			tdls_err("setup is ongoing. action %d declined for "
 				 QDF_MAC_ADDR_STR,
@@ -2166,7 +2166,7 @@ int tdls_process_set_responder(struct tdls_set_responder_req *set_req)
 		return -EINVAL;
 	}
 	curr_peer = tdls_get_peer(tdls_vdev, set_req->peer_mac);
-	if (curr_peer == NULL) {
+	if (!curr_peer) {
 		tdls_err("curr_peer is NULL");
 		return -EINVAL;
 	}

+ 10 - 10
components/tdls/core/src/wlan_tdls_ct.c

@@ -240,7 +240,7 @@ static void tdls_ct_sampling_tx_rx(struct tdls_vdev_priv_obj *tdls_vdev,
 		qdf_mem_copy(mac, mac_table[mac_cnt].mac_address.bytes,
 		       QDF_MAC_ADDR_SIZE);
 		curr_peer = tdls_get_peer(tdls_vdev, mac);
-		if (NULL != curr_peer) {
+		if (curr_peer) {
 			curr_peer->tx_pkt =
 			mac_table[mac_cnt].tx_packet_cnt;
 			curr_peer->rx_pkt =
@@ -362,28 +362,28 @@ void tdls_implicit_send_discovery_request(
 	struct tdls_soc_priv_obj *tdls_psoc;
 	struct tdls_osif_indication tdls_ind;
 
-	if (NULL == tdls_vdev_obj) {
+	if (!tdls_vdev_obj) {
 		tdls_notice("tdls_vdev_obj is NULL");
 		return;
 	}
 
 	tdls_psoc = wlan_vdev_get_tdls_soc_obj(tdls_vdev_obj->vdev);
 
-	if (NULL == tdls_psoc) {
+	if (!tdls_psoc) {
 		tdls_notice("tdls_psoc_obj is NULL");
 		return;
 	}
 
 	curr_peer = tdls_vdev_obj->curr_candidate;
 
-	if (NULL == curr_peer) {
+	if (!curr_peer) {
 		tdls_err("curr_peer is NULL");
 		return;
 	}
 
 	/* This function is called in mutex_lock */
 	temp_peer = tdls_is_progress(tdls_vdev_obj, NULL, 0);
-	if (NULL != temp_peer) {
+	if (temp_peer) {
 		tdls_notice(QDF_MAC_ADDR_STR " ongoing. pre_setup ignored",
 			    QDF_MAC_ADDR_ARRAY(temp_peer->peer_mac.bytes));
 		goto done;
@@ -434,13 +434,13 @@ int tdls_recv_discovery_resp(struct tdls_vdev_priv_obj *tdls_vdev,
 		return -EINVAL;
 
 	tdls_soc = wlan_vdev_get_tdls_soc_obj(tdls_vdev->vdev);
-	if (NULL == tdls_soc) {
+	if (!tdls_soc) {
 		tdls_err("tdls soc is NULL");
 		return -EINVAL;
 	}
 
 	curr_peer = tdls_get_peer(tdls_vdev, mac);
-	if (NULL == curr_peer) {
+	if (!curr_peer) {
 		tdls_err("curr_peer is NULL");
 		return -EINVAL;
 	}
@@ -595,7 +595,7 @@ tdls_ct_process_idle_handler(struct wlan_objmgr_vdev *vdev,
 	curr_peer = tdls_find_peer(tdls_vdev_obj,
 		(u8 *) &tdls_info->peer_mac.bytes[0]);
 
-	if (NULL == curr_peer) {
+	if (!curr_peer) {
 		tdls_err("Invalid tdls idle timer expired");
 		return;
 	}
@@ -1046,7 +1046,7 @@ int tdls_set_tdls_offchannelmode(struct wlan_objmgr_vdev *vdev,
 	}
 
 	conn_peer = tdls_find_first_connected_peer(tdls_vdev);
-	if (NULL == conn_peer) {
+	if (!conn_peer) {
 		tdls_err("No TDLS Connected Peer");
 		return -EPERM;
 	}
@@ -1112,7 +1112,7 @@ int tdls_set_tdls_offchannelmode(struct wlan_objmgr_vdev *vdev,
 
 	if (ENABLE_CHANSWITCH == offchanmode) {
 		conn_peer = tdls_find_first_connected_peer(tdls_vdev);
-		if (NULL == conn_peer) {
+		if (!conn_peer) {
 			tdls_err("No TDLS Connected Peer");
 			return -EPERM;
 		}

+ 6 - 6
components/tdls/core/src/wlan_tdls_main.c

@@ -766,7 +766,7 @@ QDF_STATUS tdls_get_vdev_objects(struct wlan_objmgr_vdev *vdev,
 {
 	enum QDF_OPMODE device_mode;
 
-	if (NULL == vdev)
+	if (!vdev)
 		return QDF_STATUS_E_FAILURE;
 
 	*tdls_vdev_obj = wlan_vdev_get_tdls_vdev_obj(vdev);
@@ -896,7 +896,7 @@ void tdls_set_ct_mode(struct wlan_objmgr_psoc *psoc)
 	struct tdls_soc_priv_obj *tdls_soc_obj;
 
 	tdls_soc_obj = wlan_psoc_get_tdls_soc_obj(psoc);
-	if (NULL == tdls_soc_obj)
+	if (!tdls_soc_obj)
 		return;
 
 	/* If any concurrency is detected, skip tdls pkt tracker */
@@ -1312,7 +1312,7 @@ tdls_process_sta_disconnect(struct tdls_sta_notify_params *notify)
 	 */
 	if (!notify->lfr_roam && !tdls_soc_obj->tdls_disable_in_progress) {
 		temp_vdev = tdls_get_vdev(tdls_soc_obj->soc, WLAN_TDLS_NB_ID);
-		if (NULL != temp_vdev) {
+		if (temp_vdev) {
 			vdev_id = wlan_vdev_get_id(temp_vdev);
 			status = tdls_get_vdev_objects(temp_vdev,
 						       &tdls_vdev_obj,
@@ -1605,7 +1605,7 @@ static void tdls_set_current_mode(struct tdls_soc_priv_obj *tdls_soc,
 	vdev = wlan_objmgr_get_vdev_by_opmode_from_psoc(tdls_soc->soc,
 							QDF_STA_MODE,
 							WLAN_TDLS_NB_ID);
-	if (NULL != vdev) {
+	if (vdev) {
 		tdls_debug("set mode in tdls vdev ");
 		tdls_vdev = wlan_vdev_get_tdls_vdev_obj(vdev);
 		if (!tdls_vdev)
@@ -1618,7 +1618,7 @@ static void tdls_set_current_mode(struct tdls_soc_priv_obj *tdls_soc,
 	vdev = wlan_objmgr_get_vdev_by_opmode_from_psoc(tdls_soc->soc,
 							QDF_P2P_CLIENT_MODE,
 							WLAN_TDLS_NB_ID);
-	if (NULL != vdev) {
+	if (vdev) {
 		tdls_debug("set mode in tdls vdev ");
 		tdls_vdev = wlan_vdev_get_tdls_vdev_obj(vdev);
 		if (!tdls_vdev)
@@ -1757,7 +1757,7 @@ QDF_STATUS tdls_scan_callback(struct tdls_soc_priv_obj *tdls_soc)
 		goto  return_success;
 
 	curr_peer = tdls_is_progress(tdls_vdev, NULL, 0);
-	if (NULL != curr_peer) {
+	if (curr_peer) {
 		if (tdls_soc->scan_reject_count++ >= TDLS_SCAN_REJECT_MAX) {
 			tdls_notice(QDF_MAC_ADDR_STR
 				    ". scan rejected %d. force it to idle",

+ 2 - 2
components/tdls/core/src/wlan_tdls_mgmt.c

@@ -61,7 +61,7 @@ static int tdls_set_rssi(struct tdls_vdev_priv_obj *tdls_vdev,
 	struct tdls_peer *curr_peer;
 
 	curr_peer = tdls_find_peer(tdls_vdev, mac);
-	if (curr_peer == NULL) {
+	if (!curr_peer) {
 		tdls_err("curr_peer is NULL");
 		return -EINVAL;
 	}
@@ -246,7 +246,7 @@ static QDF_STATUS tdls_activate_send_mgmt_request(
 
 	tdls_mgmt_req = qdf_mem_malloc(sizeof(struct tdls_send_mgmt_request) +
 				action_req->tdls_mgmt.len);
-	if (NULL == tdls_mgmt_req) {
+	if (!tdls_mgmt_req) {
 		status = QDF_STATUS_E_NOMEM;
 		tdls_err("mem alloc failed ");
 		QDF_ASSERT(0);

+ 1 - 1
components/tdls/dispatcher/src/wlan_tdls_ucfg_api.c

@@ -694,7 +694,7 @@ QDF_STATUS ucfg_tdls_send_mgmt_frame(
 	qdf_mem_copy(mgmt_req, req, sizeof(*req));
 
 	/*populate the additional IE's */
-	if ((0 != req->len) && (NULL != req->cmd_buf)) {
+	if ((0 != req->len) && (req->cmd_buf)) {
 		qdf_mem_copy(mgmt_req->tdls_mgmt.buf, req->cmd_buf,
 				req->len);
 		mgmt_req->tdls_mgmt.len = req->len;