mwifiex: Fix reporting 'operation not supported' error code
authorPali Rohár <pali@kernel.org>
Fri, 3 Jul 2020 11:21:51 +0000 (13:21 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 15 Jul 2020 09:13:04 +0000 (12:13 +0300)
ENOTSUPP (double PP) is internal linux kernel code 524 available only in
kernel include file linux/errno.h and not exported to userspace.

EOPNOTSUPP (OP; double PP) is standard code 95 for reporting 'operation not
supported' available via kernel include file uapi/asm-generic/errno.h.

ENOTSUP (single P) is alias for EOPNOTSUPP defined only in userspace
include file bits/errno.h and not available in kernel.

Because Linux kernel does not support ENOTSUP (single P) and because
userspace does not support ENOTSUPP (double PP), report error code for
'operation not supported' via EOPNOTSUPP macro.

This patch fixes problem that mwifiex kernel driver sends to userspace
unsupported error codes like: "failed: -524 (No error information)".
After applying this patch userspace see: "failed: -95 (Not supported)".

Signed-off-by: Pali Rohár <pali@kernel.org>
Acked-by: Ganapathi Bhat <ganapathi.bhat@nxp.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200703112151.18917-1-pali@kernel.org
drivers/net/wireless/marvell/mwifiex/cfg80211.c
drivers/net/wireless/marvell/mwifiex/main.c
drivers/net/wireless/marvell/mwifiex/sta_cmd.c

index 867b5cf385a8230fad5e174bef51ef04421b18d2..96848fa0e417cfd5a73382eb9e99b19e063fb2fd 100644 (file)
@@ -3727,11 +3727,11 @@ mwifiex_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
        int ret;
 
        if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS))
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
 
        /* make sure we are in station mode and connected */
        if (!(priv->bss_type == MWIFIEX_BSS_TYPE_STA && priv->media_connected))
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
 
        switch (action_code) {
        case WLAN_TDLS_SETUP_REQUEST:
@@ -3799,11 +3799,11 @@ mwifiex_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
 
        if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) ||
            !(wiphy->flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP))
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
 
        /* make sure we are in station mode and connected */
        if (!(priv->bss_type == MWIFIEX_BSS_TYPE_STA && priv->media_connected))
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
 
        mwifiex_dbg(priv->adapter, MSG,
                    "TDLS peer=%pM, oper=%d\n", peer, action);
@@ -3833,7 +3833,7 @@ mwifiex_cfg80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
        default:
                mwifiex_dbg(priv->adapter, ERROR,
                            "tdls_oper: operation not supported\n");
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        }
 
        return mwifiex_tdls_oper(priv, peer, action);
@@ -3914,11 +3914,11 @@ mwifiex_cfg80211_add_station(struct wiphy *wiphy, struct net_device *dev,
        struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
 
        if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)))
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
 
        /* make sure we are in station mode and connected */
        if ((priv->bss_type != MWIFIEX_BSS_TYPE_STA) || !priv->media_connected)
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
 
        return mwifiex_tdls_oper(priv, mac, MWIFIEX_TDLS_CREATE_LINK);
 }
@@ -4151,11 +4151,11 @@ mwifiex_cfg80211_change_station(struct wiphy *wiphy, struct net_device *dev,
 
        /* we support change_station handler only for TDLS peers*/
        if (!(params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)))
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
 
        /* make sure we are in station mode and connected */
        if ((priv->bss_type != MWIFIEX_BSS_TYPE_STA) || !priv->media_connected)
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
 
        priv->sta_params = params;
 
index 529099137644a2c4defb3ccd3f9ea6390e03304b..9ee5600351a79a95fbb03bbe933696f103326bc6 100644 (file)
@@ -953,7 +953,7 @@ int mwifiex_set_mac_address(struct mwifiex_private *priv,
        } else {
                /* Internal mac address change */
                if (priv->bss_type == MWIFIEX_BSS_TYPE_ANY)
-                       return -ENOTSUPP;
+                       return -EOPNOTSUPP;
 
                mac_addr = old_mac_addr;
 
index 8bd355d7974e91d251cb8399d9806512b0b25016..d3a968ef21ef9881963295d98a2de780d3db475d 100644 (file)
@@ -1723,7 +1723,7 @@ mwifiex_cmd_tdls_config(struct mwifiex_private *priv,
        default:
                mwifiex_dbg(priv->adapter, ERROR,
                            "Unknown TDLS configuration\n");
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        }
 
        le16_unaligned_add_cpu(&cmd->size, len);
@@ -1849,7 +1849,7 @@ mwifiex_cmd_tdls_oper(struct mwifiex_private *priv,
                break;
        default:
                mwifiex_dbg(priv->adapter, ERROR, "Unknown TDLS operation\n");
-               return -ENOTSUPP;
+               return -EOPNOTSUPP;
        }
 
        le16_unaligned_add_cpu(&cmd->size, config_len);