From: Jouni Malinen Date: Fri, 23 Sep 2016 09:19:57 +0000 (+0300) Subject: nl80211: Remove unnecessary duplication from nl80211_set_param() X-Git-Tag: hostap_2_6~33 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=mech_eap.git;a=commitdiff_plain;h=ef24ad3ec5bee3237ff00abd6292891a0c1bf008 nl80211: Remove unnecessary duplication from nl80211_set_param() There is no need to find bss->drv separately for each parameter, so do this once at the beginning of the function. Signed-off-by: Jouni Malinen --- diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 9587eb4..1210d43 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -6988,15 +6988,15 @@ static int nl80211_send_frame(void *priv, const u8 *data, size_t data_len, static int nl80211_set_param(void *priv, const char *param) { + struct i802_bss *bss = priv; + struct wpa_driver_nl80211_data *drv = bss->drv; + if (param == NULL) return 0; wpa_printf(MSG_DEBUG, "nl80211: driver param='%s'", param); #ifdef CONFIG_P2P if (os_strstr(param, "use_p2p_group_interface=1")) { - struct i802_bss *bss = priv; - struct wpa_driver_nl80211_data *drv = bss->drv; - wpa_printf(MSG_DEBUG, "nl80211: Use separate P2P group " "interface"); drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CONCURRENT; @@ -7004,28 +7004,18 @@ static int nl80211_set_param(void *priv, const char *param) } #endif /* CONFIG_P2P */ - if (os_strstr(param, "use_monitor=1")) { - struct i802_bss *bss = priv; - struct wpa_driver_nl80211_data *drv = bss->drv; + if (os_strstr(param, "use_monitor=1")) drv->use_monitor = 1; - } if (os_strstr(param, "force_connect_cmd=1")) { - struct i802_bss *bss = priv; - struct wpa_driver_nl80211_data *drv = bss->drv; drv->capa.flags &= ~WPA_DRIVER_FLAGS_SME; drv->force_connect_cmd = 1; } - if (os_strstr(param, "force_bss_selection=1")) { - struct i802_bss *bss = priv; - struct wpa_driver_nl80211_data *drv = bss->drv; + if (os_strstr(param, "force_bss_selection=1")) drv->capa.flags |= WPA_DRIVER_FLAGS_BSS_SELECTION; - } if (os_strstr(param, "no_offchannel_tx=1")) { - struct i802_bss *bss = priv; - struct wpa_driver_nl80211_data *drv = bss->drv; drv->capa.flags &= ~WPA_DRIVER_FLAGS_OFFCHANNEL_TX; drv->test_use_roc_tx = 1; }