All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/iscsi: fix possible condition with no effect (if == else)
@ 2019-05-25 17:56 ` Hariprasad Kelam
  0 siblings, 0 replies; 3+ messages in thread
From: Hariprasad Kelam @ 2019-05-25 17:44 UTC (permalink / raw)
  To: Martin K. Petersen, Hariprasad Kelam, linux-scsi, target-devel,
	linux-kernel

fix below warning reported by coccicheck

drivers/target/iscsi/iscsi_target_nego.c:175:6-8: WARNING: possible
condition with no effect (if == else)

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
 drivers/target/iscsi/iscsi_target_nego.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index 8a5e8d1..b6fb70a 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -168,12 +168,7 @@ static u32 iscsi_handle_authentication(
 	else if (strstr("CHAP", authtype))
 		return chap_main_loop(conn, auth, in_buf, out_buf,
 				&in_length, out_length);
-	else if (strstr("SPKM1", authtype))
-		return 2;
-	else if (strstr("SPKM2", authtype))
-		return 2;
-	else if (strstr("KRB5", authtype))
-		return 2;
+	/* ret 2 in  SPKM1,SPKM2,KRB5 cases */
 	else
 		return 2;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] target/iscsi: fix possible condition with no effect (if == else)
@ 2019-05-25 17:56 ` Hariprasad Kelam
  0 siblings, 0 replies; 3+ messages in thread
From: Hariprasad Kelam @ 2019-05-25 17:56 UTC (permalink / raw)
  To: Martin K. Petersen, Hariprasad Kelam, linux-scsi, target-devel,
	linux-kernel

fix below warning reported by coccicheck

drivers/target/iscsi/iscsi_target_nego.c:175:6-8: WARNING: possible
condition with no effect (if = else)

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
---
 drivers/target/iscsi/iscsi_target_nego.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
index 8a5e8d1..b6fb70a 100644
--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -168,12 +168,7 @@ static u32 iscsi_handle_authentication(
 	else if (strstr("CHAP", authtype))
 		return chap_main_loop(conn, auth, in_buf, out_buf,
 				&in_length, out_length);
-	else if (strstr("SPKM1", authtype))
-		return 2;
-	else if (strstr("SPKM2", authtype))
-		return 2;
-	else if (strstr("KRB5", authtype))
-		return 2;
+	/* ret 2 in  SPKM1,SPKM2,KRB5 cases */
 	else
 		return 2;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] target/iscsi: fix possible condition with no effect (if == else)
  2019-05-25 17:56 ` Hariprasad Kelam
  (?)
@ 2019-05-27  9:31 ` David Disseldorp
  -1 siblings, 0 replies; 3+ messages in thread
From: David Disseldorp @ 2019-05-27  9:31 UTC (permalink / raw)
  To: target-devel

On Sat, 25 May 2019 23:14:16 +0530, Hariprasad Kelam wrote:

> fix below warning reported by coccicheck
> 
> drivers/target/iscsi/iscsi_target_nego.c:175:6-8: WARNING: possible
> condition with no effect (if = else)
> 
> Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
> ---
>  drivers/target/iscsi/iscsi_target_nego.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
> index 8a5e8d1..b6fb70a 100644
> --- a/drivers/target/iscsi/iscsi_target_nego.c
> +++ b/drivers/target/iscsi/iscsi_target_nego.c
> @@ -168,12 +168,7 @@ static u32 iscsi_handle_authentication(
>  	else if (strstr("CHAP", authtype))
>  		return chap_main_loop(conn, auth, in_buf, out_buf,
>  				&in_length, out_length);
> -	else if (strstr("SPKM1", authtype))
> -		return 2;
> -	else if (strstr("SPKM2", authtype))
> -		return 2;
> -	else if (strstr("KRB5", authtype))
> -		return 2;
> +	/* ret 2 in  SPKM1,SPKM2,KRB5 cases */
>  	else
>  		return 2;
>  }

Looks okay, though I'd prefer to drop the unnecessary "else" too. The
CANSRP hunk can also be removed here. I.e. something like:

--- a/drivers/target/iscsi/iscsi_target_nego.c
+++ b/drivers/target/iscsi/iscsi_target_nego.c
@@ -160,22 +160,11 @@ static u32 iscsi_handle_authentication(
 
        if (strstr("None", authtype))
                return 1;
-#ifdef CANSRP
-       else if (strstr("SRP", authtype))
-               return srp_main_loop(conn, auth, in_buf, out_buf,
-                               &in_length, out_length);
-#endif
        else if (strstr("CHAP", authtype))
                return chap_main_loop(conn, auth, in_buf, out_buf,
                                &in_length, out_length);
-       else if (strstr("SPKM1", authtype))
-               return 2;
-       else if (strstr("SPKM2", authtype))
-               return 2;
-       else if (strstr("KRB5", authtype))
-               return 2;
-       else
-               return 2;
+       /* SRP, SPKM1, SPKM2 and KRB5 are unsupported */
+       return 2;
 }

Cheers, David

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-27  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-25 17:44 [PATCH] target/iscsi: fix possible condition with no effect (if == else) Hariprasad Kelam
2019-05-25 17:56 ` Hariprasad Kelam
2019-05-27  9:31 ` David Disseldorp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.