Skip to contentSkip to conversation

brcmfmac: print errors if creating interface fails

PATCH Superseded Arend van Spriel 3 participants 3 messages May 27, 2016 Broadcom BRCM80211 IEEE802.11 wireless drivers

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 brcmfmac: print errors if creating interface fails

From: Rafał Miłecki <[email protected]>

This is helpful for debugging. Without this all I was getting from "iw" command on failed creating of P2P interface was:

Quoted 1 line

command failed: Too many open files in system (-23)

[[email protected]: reduce error prints upon iface creation]

---
V2: s/in/if/ in commit message
V3: Add one more error message as suggested by Arend
V4: Also update brcmf_cfg80211_add_iface & print error for AP
V5: remove error prints from p2p.c

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 12 ++++++++++--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c      |  2 --
 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +10 -2
index d0631b6..64ed003 100644
@@ -671,18 +671,26 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
 		wdev = brcmf_ap_add_vif(wiphy, name, flags, params);
 		if (!IS_ERR(wdev))
 			brcmf_cfg80211_update_proto_addr_mode(wdev);
-		return wdev;
+		break;
 	case NL80211_IFTYPE_P2P_CLIENT:
 	case NL80211_IFTYPE_P2P_GO:
 	case NL80211_IFTYPE_P2P_DEVICE:
 		wdev = brcmf_p2p_add_vif(wiphy, name, name_assign_type, type, flags, params);
 		if (!IS_ERR(wdev))
 			brcmf_cfg80211_update_proto_addr_mode(wdev);
-		return wdev;
+		break;
 	case NL80211_IFTYPE_UNSPECIFIED:
 	default:
 		return ERR_PTR(-EINVAL);
 	}
+
+	if (IS_ERR(wdev))
+		brcmf_err("add iface %s type %d failed: err=%d\n",
+			  name, type, PTR_ERR(wdev));
+	else
+		brcmf_cfg80211_update_proto_addr_mode(wdev);
+
+	return wdev;
 }
 
 static void brcmf_scan_config_mpc(struct brcmf_if *ifp, int mpc)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +0 -2
index a70cda6..a812381 100644
@@ -2030,8 +2030,6 @@ static int brcmf_p2p_request_p2p_if(struct brcmf_p2p_info *p2p,
 
 	err = brcmf_fil_iovar_data_set(ifp, "p2p_ifadd", &if_request,
 				       sizeof(if_request));
-	if (err)
-		return err;
 
 	return err;
 }
Signature · 1 line
1.9.1
#1 lore raw

Hi Arend,

Quoted 37 lines · Arend van Spriel

From: Rafał Miłecki <[email protected]>

This is helpful for debugging. Without this all I was getting from "iw" command on failed creating of P2P interface was:

Quoted 1 line

command failed: Too many open files in system (-23)

[[email protected]: reduce error prints upon iface creation]

---
V2: s/in/if/ in commit message
V3: Add one more error message as suggested by Arend
V4: Also update brcmf_cfg80211_add_iface & print error for AP
V5: remove error prints from p2p.c

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 12 ++++++++++--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c      |  2 --
 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +2 -2
index d0631b6..64ed003 100644
@@ -671,18 +671,26 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
                wdev = brcmf_ap_add_vif(wiphy, name, flags, params);
                if (!IS_ERR(wdev))
                        brcmf_cfg80211_update_proto_addr_mode(wdev);
-               return wdev;
+               break;
        case NL80211_IFTYPE_P2P_CLIENT:
        case NL80211_IFTYPE_P2P_GO:
        case NL80211_IFTYPE_P2P_DEVICE:
                wdev = brcmf_p2p_add_vif(wiphy, name, name_assign_type, type, flags, params);
                if (!IS_ERR(wdev))
                        brcmf_cfg80211_update_proto_addr_mode(wdev);
-               return wdev;
+               break;

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy, · line 691

Quoted 10 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +6 -0
        case NL80211_IFTYPE_UNSPECIFIED:
        default:
                return ERR_PTR(-EINVAL);
        }
+
+       if (IS_ERR(wdev))
+               brcmf_err("add iface %s type %d failed: err=%d\n",
+                         name, type, PTR_ERR(wdev));
+       else
+               brcmf_cfg80211_update_proto_addr_mode(wdev);

Doesn't this now get called twice?

Thanks,

Signature · 4 lines
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
maintainer
#2 lore raw
Quoted 44 lines · Julian Calaby

Hi Arend,

Quoted 41 lines · Arend van Spriel

From: Rafał Miłecki <[email protected]>

This is helpful for debugging. Without this all I was getting from "iw" command on failed creating of P2P interface was:

Quoted 1 line

command failed: Too many open files in system (-23)

[[email protected]: reduce error prints upon iface creation]

---
V2: s/in/if/ in commit message
V3: Add one more error message as suggested by Arend
V4: Also update brcmf_cfg80211_add_iface & print error for AP
V5: remove error prints from p2p.c

---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 12 ++++++++++--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c      |  2 --
 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +2 -2
index d0631b6..64ed003 100644
@@ -671,18 +671,26 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
                wdev = brcmf_ap_add_vif(wiphy, name, flags, params);
                if (!IS_ERR(wdev))
                        brcmf_cfg80211_update_proto_addr_mode(wdev);
-               return wdev;
+               break;
        case NL80211_IFTYPE_P2P_CLIENT:
        case NL80211_IFTYPE_P2P_GO:
        case NL80211_IFTYPE_P2P_DEVICE:
                wdev = brcmf_p2p_add_vif(wiphy, name, name_assign_type, type, flags, params);
                if (!IS_ERR(wdev))
                        brcmf_cfg80211_update_proto_addr_mode(wdev);
-               return wdev;
+               break;
        case NL80211_IFTYPE_UNSPECIFIED:
        default:
                return ERR_PTR(-EINVAL);
        }
Quoted 8 lines

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy, · line 691

Quoted 6 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +6 -0
+
+       if (IS_ERR(wdev))
+               brcmf_err("add iface %s type %d failed: err=%d\n",
+                         name, type, PTR_ERR(wdev));
+       else
+               brcmf_cfg80211_update_proto_addr_mode(wdev);

Doesn't this now get called twice?

I already had it fixed in my editor, but forgot the 'git commit' step :-( Anyway, I noticed it reading back the patch email and hence there is already a V6.

Regards,
Arend

Quoted 2 lines

Thanks,