mwifiex: update cfg80211 with correct reason code when association fails
authorAmitkumar Karwar <akarwar@marvell.com>
Sat, 6 Oct 2012 03:21:42 +0000 (20:21 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 8 Oct 2012 19:06:03 +0000 (15:06 -0400)
This patch adds support to send correct reason code got from
firmware when association attempt fails. Also, the error message
displayed for association failure due to network incompatibility
is modified. Current message "cannot find ssid.." misleads user.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/cfg80211.c
drivers/net/wireless/mwifiex/scan.c

index 675247b303d72bfb0d3224841547383216e6455a..0679458a1bac44469ddf0d00935e7b165f66f9ed 100644 (file)
@@ -1596,8 +1596,9 @@ done:
                }
        }
 
-       if (mwifiex_bss_start(priv, bss, &req_ssid))
-               return -EFAULT;
+       ret = mwifiex_bss_start(priv, bss, &req_ssid);
+       if (ret)
+               return ret;
 
        if (mode == NL80211_IFTYPE_ADHOC) {
                /* Inform the BSS information to kernel, otherwise
@@ -1652,9 +1653,19 @@ done:
                        "info: association to bssid %pM failed\n",
                        priv->cfg_bssid);
                memset(priv->cfg_bssid, 0, ETH_ALEN);
+
+               if (ret > 0)
+                       cfg80211_connect_result(priv->netdev, priv->cfg_bssid,
+                                               NULL, 0, NULL, 0, ret,
+                                               GFP_KERNEL);
+               else
+                       cfg80211_connect_result(priv->netdev, priv->cfg_bssid,
+                                               NULL, 0, NULL, 0,
+                                               WLAN_STATUS_UNSPECIFIED_FAILURE,
+                                               GFP_KERNEL);
        }
 
-       return ret;
+       return 0;
 }
 
 /*
index d9295fd8e4273281304e27cfef495340cd53df2c..00b658d3b6ecfae72792b055a717aab9c41a0401 100644 (file)
@@ -1434,8 +1434,8 @@ int mwifiex_check_network_compatibility(struct mwifiex_private *priv,
                        ret = mwifiex_is_network_compatible(priv, bss_desc,
                                                            priv->bss_mode);
                        if (ret)
-                               dev_err(priv->adapter->dev, "cannot find ssid "
-                                       "%s\n", bss_desc->ssid.ssid);
+                               dev_err(priv->adapter->dev,
+                                       "Incompatible network settings\n");
                        break;
                default:
                        ret = 0;