diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 33da36d2f0..062a6d4a4d 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -4723,6 +4723,11 @@ QDF_STATUS hdd_update_nss(struct hdd_adapter *adapter, uint8_t nss) } mac_handle = hdd_ctx->mac_handle; + if (!mac_handle) { + hdd_err("NULL MAC handle"); + return QDF_STATUS_E_INVAL; + } + if (sme_is_any_session_in_connected_state(mac_handle)) { hdd_err("Connected sessions present, Do not change NSS"); return QDF_STATUS_E_INVAL; diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 897116dad2..22615ed9ee 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -4286,6 +4286,24 @@ static int hdd_we_set_tm_level(struct hdd_adapter *adapter, int level) return qdf_status_to_os_return(status); } +static int hdd_we_set_nss(struct hdd_adapter *adapter, int nss) +{ + QDF_STATUS status; + + hdd_debug("NSS %d", nss); + + if ((nss > 2) || (nss <= 0)) { + hdd_err("Invalid NSS: %d", nss); + return -EINVAL; + } + + status = hdd_update_nss(adapter, nss); + if (QDF_IS_STATUS_ERROR(status)) + hdd_err("cfg set failed, value %d status %d", nss, status); + + return qdf_status_to_os_return(status); +} + /** * iw_setint_getnone() - Generic "set integer" private ioctl handler * @dev: device upon which the ioctl was received @@ -4371,21 +4389,8 @@ static int __iw_setint_getnone(struct net_device *dev, break; case WE_SET_NSS: - { - if (!mac_handle) - return -EINVAL; - - hdd_debug("Set NSS = %d", set_value); - if ((set_value > 2) || (set_value <= 0)) { - hdd_err("NSS greater than 2 not supported"); - ret = -EINVAL; - } else { - if (QDF_STATUS_SUCCESS != - hdd_update_nss(adapter, set_value)) - ret = -EINVAL; - } + ret = hdd_we_set_nss(adapter, set_value); break; - } case WE_SET_GTX_HT_MCS: {