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
This commit is contained in:
Dustin Brown
2018-08-07 12:04:47 -07:00
committed by nshrivas
parent ef22a0610b
commit a8700cc8f5
6 changed files with 15 additions and 26 deletions

View File

@@ -2208,7 +2208,10 @@ int __wlan_hdd_validate_context(struct hdd_context *hdd_ctx, const char *func);
* *
* Return: Errno * 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 * wlan_hdd_validate_session_id() - ensure the given session Id is valid

View File

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

View File

@@ -897,39 +897,30 @@ int __wlan_hdd_validate_context(struct hdd_context *hdd_ctx, const char *func)
return 0; return 0;
} }
int hdd_validate_adapter(struct hdd_adapter *adapter) int __hdd_validate_adapter(struct hdd_adapter *adapter, const char *func)
{ {
if (!adapter) { if (!adapter) {
hdd_err("adapter is null"); hdd_err("adapter is null (via %s)", func);
return -EINVAL; return -EINVAL;
} }
if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC) { if (adapter->magic != WLAN_HDD_ADAPTER_MAGIC) {
hdd_err("bad adapter magic"); hdd_err("bad adapter magic (via %s)", func);
return -EINVAL; return -EINVAL;
} }
if (!adapter->dev) { if (!adapter->dev) {
hdd_err("adapter net_device is null"); hdd_err("adapter net_device is null (via %s)", func);
return -EINVAL; return -EINVAL;
} }
if (!(adapter->dev->flags & IFF_UP)) { 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; return -EAGAIN;
} }
if (wlan_hdd_validate_session_id(adapter->session_id)) { return __wlan_hdd_validate_session_id(adapter->session_id, func);
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;
} }
int __wlan_hdd_validate_session_id(uint8_t session_id, const char *func) int __wlan_hdd_validate_session_id(uint8_t session_id, const char *func)

View File

@@ -227,7 +227,7 @@ static void __hdd_nud_failure_work(void *data)
adapter = (struct hdd_adapter *)data; adapter = (struct hdd_adapter *)data;
status = hdd_validate_adapter(adapter); status = hdd_validate_adapter(adapter);
if (0 != status) if (status)
return; return;
hdd_ctx = WLAN_HDD_GET_CTX(adapter); 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); adapter = hdd_get_adapter_by_macaddr(hdd_ctx, netdev->dev_addr);
status = hdd_validate_adapter(adapter); status = hdd_validate_adapter(adapter);
if (0 != status) if (status)
return; return;
if (adapter->device_mode != QDF_STA_MODE) { if (adapter->device_mode != QDF_STA_MODE) {

View File

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

View File

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