diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 5c6456ddff45..2e6c7e325ac5 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -4714,8 +4714,13 @@ int wlan_hdd_restore_channels(struct hdd_context *hdd_ctx, status = sme_update_channel_list(hdd_ctx->mac_handle); if (status) hdd_err("Can't Restore channel list"); + else + /* + * Free the cache channels when the + * disabled channels are restored + */ + wlan_hdd_free_cache_channels(hdd_ctx); hdd_exit(); - return 0; } diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 70fab802d039..26b2722b35e0 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -7205,13 +7205,11 @@ static int hdd_parse_disable_chan_cmd(struct hdd_adapter *adapter, uint8_t *ptr) hdd_debug("Number of channel to disable are: %d", temp_int); if (!temp_int) { - if (!wlan_hdd_restore_channels(hdd_ctx, false)) { - /* - * Free the cache channels only when the command is - * received with num channels as 0 - */ - wlan_hdd_free_cache_channels(hdd_ctx); - } + /* + * Restore and Free the cache channels when the command is + * received with num channels as 0 + */ + wlan_hdd_restore_channels(hdd_ctx, false); return 0; }