All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Dmitry Bogdanov <d.bogdanov@yadro.com>, coolrrsh@gmail.com
Cc: linux-scsi@vger.kernel.org, martin.petersen@oracle.com,
	jejb@linux.ibm.com, james.smart@broadcom.com,
	linux-kernel@vger.kernel.org, target-devel@vger.kernel.org,
	ram.vegesna@broadcom.com,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH v2] scsi: sli4: Remove the buggy code
Date: Thu, 17 Aug 2023 07:51:56 -0700	[thread overview]
Message-ID: <79ac6ee9-247a-c3da-c0f7-8c26bd0b1ad0@infradead.org> (raw)
In-Reply-To: <20230817105252.GA14370@yadro.com>



On 8/17/23 03:52, Dmitry Bogdanov wrote:
> On Thu, Aug 17, 2023 at 04:07:51PM +0530, coolrrsh@gmail.com wrote:
>>
>> From: Rajeshwar R Shinde <coolrrsh@gmail.com>
>>
>> In the function sli_xmit_bls_rsp64_wqe, the 'if' and 'else' conditions
>> evaluates the same expression and gives same output. Also the variable
>> bls->local_n_port_id_dword is not used anywhere. Therefore removing the
>> redundant code.
>>
>> This fixes coccinelle warning such as:
>> drivers/scsi/elx/libefc_sli/sli4.c:2320:2-4: WARNING: possible
>> condition with no effect (if == else)
>>
>> Signed-off-by: Rajeshwar R Shinde <coolrrsh@gmail.com>
>> ---
>> v1->v2
>> Modified patch and verified with checkpatch.pl.
>>
>> ---
>>  drivers/scsi/elx/libefc_sli/sli4.c | 7 -------
>>  1 file changed, 7 deletions(-)
>>
>> diff --git a/drivers/scsi/elx/libefc_sli/sli4.c b/drivers/scsi/elx/libefc_sli/sli4.c
>> index 8f96049f62dd..af661b769464 100644
>> --- a/drivers/scsi/elx/libefc_sli/sli4.c
>> +++ b/drivers/scsi/elx/libefc_sli/sli4.c
>> @@ -2317,13 +2317,6 @@ sli_xmit_bls_rsp64_wqe(struct sli4 *sli, void *buf,
>>                 SLI4_GENERIC_CONTEXT_VPI << SLI4_BLS_RSP_WQE_CT_SHFT;
>>                 bls->context_tag = cpu_to_le16(params->vpi);
>>
>> -               if (params->s_id != U32_MAX)
>> -                       bls->local_n_port_id_dword |=
>> -                               cpu_to_le32(params->s_id & 0x00ffffff);
>> -               else
>> -                       bls->local_n_port_id_dword |=
>> -                               cpu_to_le32(params->s_id & 0x00ffffff);
>> -
> 
> omg, it is not an unused variable. Whole bls is a HW descriptor, all of
> its variables are used by HW. You should keep v1 version of the patch.
> According to the comment at the beginning of the funciton s_id here shall
> be != U32_MAX. That is an explanation for your v1 patch.
> 

Thanks for your comments.

>>                 dw_ridflags = (dw_ridflags & ~SLI4_BLS_RSP_RID) |
>>                                (params->d_id & SLI4_BLS_RSP_RID);
>>
>> --
>> 2.25.1
>>

-- 
~Randy
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

WARNING: multiple messages have this Message-ID (diff)
From: Randy Dunlap <rdunlap@infradead.org>
To: Dmitry Bogdanov <d.bogdanov@yadro.com>, coolrrsh@gmail.com
Cc: james.smart@broadcom.com, ram.vegesna@broadcom.com,
	jejb@linux.ibm.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH v2] scsi: sli4: Remove the buggy code
Date: Thu, 17 Aug 2023 07:51:56 -0700	[thread overview]
Message-ID: <79ac6ee9-247a-c3da-c0f7-8c26bd0b1ad0@infradead.org> (raw)
In-Reply-To: <20230817105252.GA14370@yadro.com>



On 8/17/23 03:52, Dmitry Bogdanov wrote:
> On Thu, Aug 17, 2023 at 04:07:51PM +0530, coolrrsh@gmail.com wrote:
>>
>> From: Rajeshwar R Shinde <coolrrsh@gmail.com>
>>
>> In the function sli_xmit_bls_rsp64_wqe, the 'if' and 'else' conditions
>> evaluates the same expression and gives same output. Also the variable
>> bls->local_n_port_id_dword is not used anywhere. Therefore removing the
>> redundant code.
>>
>> This fixes coccinelle warning such as:
>> drivers/scsi/elx/libefc_sli/sli4.c:2320:2-4: WARNING: possible
>> condition with no effect (if == else)
>>
>> Signed-off-by: Rajeshwar R Shinde <coolrrsh@gmail.com>
>> ---
>> v1->v2
>> Modified patch and verified with checkpatch.pl.
>>
>> ---
>>  drivers/scsi/elx/libefc_sli/sli4.c | 7 -------
>>  1 file changed, 7 deletions(-)
>>
>> diff --git a/drivers/scsi/elx/libefc_sli/sli4.c b/drivers/scsi/elx/libefc_sli/sli4.c
>> index 8f96049f62dd..af661b769464 100644
>> --- a/drivers/scsi/elx/libefc_sli/sli4.c
>> +++ b/drivers/scsi/elx/libefc_sli/sli4.c
>> @@ -2317,13 +2317,6 @@ sli_xmit_bls_rsp64_wqe(struct sli4 *sli, void *buf,
>>                 SLI4_GENERIC_CONTEXT_VPI << SLI4_BLS_RSP_WQE_CT_SHFT;
>>                 bls->context_tag = cpu_to_le16(params->vpi);
>>
>> -               if (params->s_id != U32_MAX)
>> -                       bls->local_n_port_id_dword |=
>> -                               cpu_to_le32(params->s_id & 0x00ffffff);
>> -               else
>> -                       bls->local_n_port_id_dword |=
>> -                               cpu_to_le32(params->s_id & 0x00ffffff);
>> -
> 
> omg, it is not an unused variable. Whole bls is a HW descriptor, all of
> its variables are used by HW. You should keep v1 version of the patch.
> According to the comment at the beginning of the funciton s_id here shall
> be != U32_MAX. That is an explanation for your v1 patch.
> 

Thanks for your comments.

>>                 dw_ridflags = (dw_ridflags & ~SLI4_BLS_RSP_RID) |
>>                                (params->d_id & SLI4_BLS_RSP_RID);
>>
>> --
>> 2.25.1
>>

-- 
~Randy

  parent reply	other threads:[~2023-08-17 14:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17 10:37 [PATCH v2] scsi: sli4: Remove the buggy code coolrrsh
2023-08-17 10:37 ` coolrrsh
2023-08-17 10:52 ` Dmitry Bogdanov
2023-08-17 10:52   ` Dmitry Bogdanov
2023-08-17 12:33   ` Ram Kishore Vegesna via Linux-kernel-mentees
2023-08-17 20:57     ` Greg KH
2023-08-17 20:57       ` Greg KH
2023-08-17 14:51   ` Randy Dunlap [this message]
2023-08-17 14:51     ` Randy Dunlap

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=79ac6ee9-247a-c3da-c0f7-8c26bd0b1ad0@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=coolrrsh@gmail.com \
    --cc=d.bogdanov@yadro.com \
    --cc=james.smart@broadcom.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ram.vegesna@broadcom.com \
    --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.