All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Disseldorp <ddiss@suse.de>
To: target-devel@vger.kernel.org
Subject: Re: [PATCH] target/iscsi: fix possible condition with no effect (if == else)
Date: Mon, 27 May 2019 09:31:18 +0000	[thread overview]
Message-ID: <20190527113118.68e6ab4c@suse.de> (raw)
In-Reply-To: <20190525174416.GA21510@hari-Inspiron-1545>

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

      reply	other threads:[~2019-05-27  9:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190527113118.68e6ab4c@suse.de \
    --to=ddiss@suse.de \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.