[PATCH] Combine multiple function call to single statement

Purushottam Kushwaha p.kushwaha at samsung.com
Fri Jun 12 07:36:27 EDT 2015


Signed-off-by: Purushottam Kushwaha <p.kushwaha at samsung.com>
---
 wpa_supplicant/ctrl_iface.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index f32b7c9..45ef14f 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -5523,7 +5523,7 @@ static int p2p_ctrl_group_add_persistent(struct wpa_supplicant *wpa_s,
 
 static int p2p_ctrl_group_add(struct wpa_supplicant *wpa_s, char *cmd)
 {
-	int freq = 0, ht40, vht;
+	int freq = 0, persistent_group = 0, ht40, vht;
 	char *pos;
 
 	pos = os_strstr(cmd, "freq=");
@@ -5539,11 +5539,10 @@ static int p2p_ctrl_group_add(struct wpa_supplicant *wpa_s, char *cmd)
 						     ht40, vht);
 	if (os_strcmp(cmd, "persistent") == 0 ||
 	    os_strncmp(cmd, "persistent ", 11) == 0)
-		return wpas_p2p_group_add(wpa_s, 1, freq, ht40, vht);
-	if (os_strncmp(cmd, "freq=", 5) == 0)
-		return wpas_p2p_group_add(wpa_s, 0, freq, ht40, vht);
-	if (ht40)
-		return wpas_p2p_group_add(wpa_s, 0, freq, ht40, vht);
+		persistent_group = 1;
+
+	if(persistent_group || (os_strncmp(cmd, "freq=", 5) == 0) || ht40)
+		return wpas_p2p_group_add(wpa_s, persistent_group, freq, ht40, vht);
 
 	wpa_printf(MSG_DEBUG, "CTRL: Invalid P2P_GROUP_ADD parameters '%s'",
 		   cmd);
-- 
1.9.1


More information about the HostAP mailing list