浏览代码

qcacld-3.0: Add caller to validate adapter logs

The error logs in hdd_validate_adapter are mostly useless without
knowing where it was called from. To avoid adding additional logs at all
of the call sites, log the caller information from hdd_validate_adapter
itself.

Change-Id: If953412c8435069c0ab87649fbf54130eb81cd09
CRs-Fixed: 2292705
Dustin Brown 6 年之前
父节点
当前提交
a8700cc8f5

+ 4 - 1
core/hdd/inc/wlan_hdd_main.h

@@ -2208,7 +2208,10 @@ int __wlan_hdd_validate_context(struct hdd_context *hdd_ctx, const char *func);
  *
  * Return: Errno
  */
-int hdd_validate_adapter(struct hdd_adapter *adapter);
+#define hdd_validate_adapter(adapter) \
+	__hdd_validate_adapter(adapter, __func__)
+
+int __hdd_validate_adapter(struct hdd_adapter *adapter, const char *func);
 
 /**
  * wlan_hdd_validate_session_id() - ensure the given session Id is valid

+ 0 - 1
core/hdd/src/wlan_hdd_ipa.c

@@ -391,7 +391,6 @@ void hdd_ipa_send_skb_to_network(qdf_nbuf_t skb, qdf_netdev_t dev)
 	uint32_t enabled;
 
 	if (hdd_validate_adapter(adapter)) {
-		hdd_debug_rl("Invalid adapter: 0x%pK", adapter);
 		kfree_skb(skb);
 		return;
 	}

+ 7 - 16
core/hdd/src/wlan_hdd_main.c

@@ -897,39 +897,30 @@ int __wlan_hdd_validate_context(struct hdd_context *hdd_ctx, const char *func)
 	return 0;
 }
 
-int hdd_validate_adapter(struct hdd_adapter *adapter)
+int __hdd_validate_adapter(struct hdd_adapter *adapter, const char *func)
 {
 	if (!adapter) {
-		hdd_err("adapter is null");
+		hdd_err("adapter is null (via %s)", func);
 		return -EINVAL;
 	}
 
 	if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC) {
-		hdd_err("bad adapter magic");
+		hdd_err("bad adapter magic (via %s)", func);
 		return -EINVAL;
 	}
 
 	if (!adapter->dev) {
-		hdd_err("adapter net_device is null");
+		hdd_err("adapter net_device is null (via %s)", func);
 		return -EINVAL;
 	}
 
 	if (!(adapter->dev->flags & IFF_UP)) {
-		hdd_info("adapter net_device is not up");
+		hdd_debug_rl("adapter '%s' is not up (via %s)",
+			     adapter->dev->name, func);
 		return -EAGAIN;
 	}
 
-	if (wlan_hdd_validate_session_id(adapter->session_id)) {
-		hdd_info("adapter session is not open");
-		return -EAGAIN;
-	}
-
-	if (adapter->session_id >= CSR_ROAM_SESSION_MAX) {
-		hdd_err("bad adapter session Id: %u", adapter->session_id);
-		return -EINVAL;
-	}
-
-	return 0;
+	return __wlan_hdd_validate_session_id(adapter->session_id, func);
 }
 
 int __wlan_hdd_validate_session_id(uint8_t session_id, const char *func)

+ 2 - 2
core/hdd/src/wlan_hdd_nud_tracking.c

@@ -227,7 +227,7 @@ static void __hdd_nud_failure_work(void *data)
 	adapter = (struct hdd_adapter *)data;
 
 	status = hdd_validate_adapter(adapter);
-	if (0 != status)
+	if (status)
 		return;
 
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
@@ -348,7 +348,7 @@ static void hdd_nud_filter_netevent(struct neighbour *neigh)
 
 	adapter = hdd_get_adapter_by_macaddr(hdd_ctx, netdev->dev_addr);
 	status = hdd_validate_adapter(adapter);
-	if (0 != status)
+	if (status)
 		return;
 
 	if (adapter->device_mode != QDF_STA_MODE) {

+ 1 - 3
core/hdd/src/wlan_hdd_softap_tx_rx.c

@@ -299,10 +299,8 @@ static void hdd_softap_notify_dhcp_ind(void *context, struct sk_buff *netbuf)
 	uint8_t sta_id;
 	struct hdd_adapter *adapter = context;
 
-	if (hdd_validate_adapter(adapter)) {
-		hdd_err("Invalid adapter");
+	if (hdd_validate_adapter(adapter))
 		return;
-	}
 
 	hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
 	if (!hdd_ap_ctx) {

+ 1 - 3
core/hdd/src/wlan_hdd_stats.c

@@ -1257,10 +1257,8 @@ __wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy,
 	if (0 != status)
 		return -EINVAL;
 
-	if (hdd_validate_adapter(adapter)) {
-		hdd_err("Invalid Adapter");
+	if (hdd_validate_adapter(adapter))
 		return -EINVAL;
-	}
 
 	if (adapter->device_mode != QDF_STA_MODE) {
 		hdd_debug("Cannot set LL_STATS for device mode %d",