diff mbox

Redundant check removed There was an extra check before return ,which was allready checked once shouldnt be done again.

Message ID 1481293824-20155-1-git-send-email-bipin.k@samsung.com
State Changes Requested
Headers show

Commit Message

Bipin Kumar Dec. 9, 2016, 2:30 p.m. UTC
Signed-off-by: Bipin Kumar <bipin.k@samsung.com>
Signed-off-by: Avichal Agrawal <avichal.a@samsung.com>
---
 wpa_supplicant/ctrl_iface_named_pipe.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jouni Malinen Dec. 10, 2016, 8:23 p.m. UTC | #1
On Fri, Dec 09, 2016 at 08:00:24PM +0530, Bipin Kumar wrote:
> diff --git a/wpa_supplicant/ctrl_iface_named_pipe.c b/wpa_supplicant/ctrl_iface_named_pipe.c
> @@ -392,10 +392,10 @@ static int ctrl_iface_parse(struct ctrl_iface_priv *priv, const char *params)
>  		sddl = os_strstr(params, " SDDL=");
>  		if (sddl)
>  			sddl += 6;
> +		else
> +			return 0;
>  	}
>  
> -	if (!sddl)
> -		return 0;

Could you please explain why you would like to change this and how that
existing check would be redundant? This patch is just moving the check
to another place, not removing redundant code.. The existing
implementation looks correct and clearer that what would be there with
this patch applied. This function has multiple ways of setting the sddl
pointer and this existing check at the end verifies all those cases.
diff mbox

Patch

diff --git a/wpa_supplicant/ctrl_iface_named_pipe.c b/wpa_supplicant/ctrl_iface_named_pipe.c
index 54e0e2f..cc50e3d 100644
--- a/wpa_supplicant/ctrl_iface_named_pipe.c
+++ b/wpa_supplicant/ctrl_iface_named_pipe.c
@@ -392,10 +392,10 @@  static int ctrl_iface_parse(struct ctrl_iface_priv *priv, const char *params)
 		sddl = os_strstr(params, " SDDL=");
 		if (sddl)
 			sddl += 6;
+		else
+			return 0;
 	}
 
-	if (!sddl)
-		return 0;
 
 	wpa_printf(MSG_DEBUG, "CTRL: SDDL='%s'", sddl);
 	os_memset(&priv->attr, 0, sizeof(priv->attr));