public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] remove double test condition
@ 2018-08-02  2:44 zhong jiang
  2018-08-02  2:45 ` [PATCH 1/2] scsi:qla1280: remove unnessary same condition check zhong jiang
  2018-08-02  2:45 ` [PATCH 2/2] scsi:qlogicfas408: remove the same check in qlogicfas408_detect zhong jiang
  0 siblings, 2 replies; 8+ messages in thread
From: zhong jiang @ 2018-08-02  2:44 UTC (permalink / raw)
  To: andy.shevchenko, john.garry, jejb, martin.petersen, aacraid
  Cc: linux-scsi, linux-kernel


zhong jiang (2):
  scsi:qla1280: remove unnessary same condition check
  scsi:qlogicfas408: remove the same check in qlogicfas408_detect

 drivers/scsi/qla1280.c      | 1 -
 drivers/scsi/qlogicfas408.c | 3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

-- 
1.7.12.4


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

* [PATCH 1/2] scsi:qla1280: remove unnessary same condition check
  2018-08-02  2:44 [PATCH 0/2] remove double test condition zhong jiang
@ 2018-08-02  2:45 ` zhong jiang
  2018-08-02  3:22   ` Bart Van Assche
  2018-08-02  2:45 ` [PATCH 2/2] scsi:qlogicfas408: remove the same check in qlogicfas408_detect zhong jiang
  1 sibling, 1 reply; 8+ messages in thread
From: zhong jiang @ 2018-08-02  2:45 UTC (permalink / raw)
  To: andy.shevchenko, john.garry, jejb, martin.petersen, aacraid
  Cc: linux-scsi, linux-kernel

doulbe test in a expression is redundant. so just remove one of
them.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/scsi/qla1280.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 390775d..8e6f156 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -1504,7 +1504,6 @@ static void qla1280_mailbox_timeout(struct timer_list *t)
 	/* Issue SCSI reset, if we can't reset twice then bus is dead */
 	for (bus = 0; bus < ha->ports; bus++) {
 		if (!ha->bus_settings[bus].disable_scsi_reset &&
-		    qla1280_bus_reset(ha, bus) &&
 		    qla1280_bus_reset(ha, bus))
 			ha->bus_settings[bus].scsi_bus_dead = 1;
 	}
-- 
1.7.12.4


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

* [PATCH 2/2] scsi:qlogicfas408: remove the same check in qlogicfas408_detect
  2018-08-02  2:44 [PATCH 0/2] remove double test condition zhong jiang
  2018-08-02  2:45 ` [PATCH 1/2] scsi:qla1280: remove unnessary same condition check zhong jiang
@ 2018-08-02  2:45 ` zhong jiang
  2018-08-02  3:21   ` Bart Van Assche
  1 sibling, 1 reply; 8+ messages in thread
From: zhong jiang @ 2018-08-02  2:45 UTC (permalink / raw)
  To: andy.shevchenko, john.garry, jejb, martin.petersen, aacraid
  Cc: linux-scsi, linux-kernel

we should not use same check in a expression. just remove one
of them.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 drivers/scsi/qlogicfas408.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
index 8b471a9..1409ac1 100644
--- a/drivers/scsi/qlogicfas408.c
+++ b/drivers/scsi/qlogicfas408.c
@@ -567,8 +567,7 @@ void qlogicfas408_setup(int qbase, int id, int int_type)
 int qlogicfas408_detect(int qbase, int int_type)
 {
         REG1;
-	return (((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7) &&
-	       ((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7));		
+	return (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7;
 }
 
 /*
-- 
1.7.12.4


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

* Re: [PATCH 2/2] scsi:qlogicfas408: remove the same check in qlogicfas408_detect
  2018-08-02  2:45 ` [PATCH 2/2] scsi:qlogicfas408: remove the same check in qlogicfas408_detect zhong jiang
@ 2018-08-02  3:21   ` Bart Van Assche
  2018-08-02  3:29     ` zhong jiang
  0 siblings, 1 reply; 8+ messages in thread
From: Bart Van Assche @ 2018-08-02  3:21 UTC (permalink / raw)
  To: andy.shevchenko@gmail.com, zhongjiang@huawei.com,
	aacraid@microsemi.com, jejb@linux.vnet.ibm.com,
	john.garry@huawei.com, martin.petersen@oracle.com
  Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org

On Thu, 2018-08-02 at 10:45 +0800, zhong jiang wrote:
> we should not use same check in a expression. just remove one
> of them.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  drivers/scsi/qlogicfas408.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
> index 8b471a9..1409ac1 100644
> --- a/drivers/scsi/qlogicfas408.c
> +++ b/drivers/scsi/qlogicfas408.c
> @@ -567,8 +567,7 @@ void qlogicfas408_setup(int qbase, int id, int int_type)
>  int qlogicfas408_detect(int qbase, int int_type)
>  {
>          REG1;
> -	return (((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7) &&
> -	       ((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7));		
> +	return (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7;
>  }

Does inb() have any side effects?

Bart.


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

* Re: [PATCH 1/2] scsi:qla1280: remove unnessary same condition check
  2018-08-02  2:45 ` [PATCH 1/2] scsi:qla1280: remove unnessary same condition check zhong jiang
@ 2018-08-02  3:22   ` Bart Van Assche
  0 siblings, 0 replies; 8+ messages in thread
From: Bart Van Assche @ 2018-08-02  3:22 UTC (permalink / raw)
  To: andy.shevchenko@gmail.com, zhongjiang@huawei.com,
	aacraid@microsemi.com, jejb@linux.vnet.ibm.com,
	john.garry@huawei.com, martin.petersen@oracle.com
  Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org

On Thu, 2018-08-02 at 10:45 +0800, zhong jiang wrote:
> doulbe test in a expression is redundant. so just remove one of
> them.
> 
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  drivers/scsi/qla1280.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
> index 390775d..8e6f156 100644
> --- a/drivers/scsi/qla1280.c
> +++ b/drivers/scsi/qla1280.c
> @@ -1504,7 +1504,6 @@ static void qla1280_mailbox_timeout(struct timer_list *t)
>  	/* Issue SCSI reset, if we can't reset twice then bus is dead */
>  	for (bus = 0; bus < ha->ports; bus++) {
>  		if (!ha->bus_settings[bus].disable_scsi_reset &&
> -		    qla1280_bus_reset(ha, bus) &&
>  		    qla1280_bus_reset(ha, bus))
>  			ha->bus_settings[bus].scsi_bus_dead = 1;
>  	}

Same question here: does qla1280_bus_reset() have any side effects?

Bart.


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

* Re: [PATCH 2/2] scsi:qlogicfas408: remove the same check in qlogicfas408_detect
  2018-08-02  3:21   ` Bart Van Assche
@ 2018-08-02  3:29     ` zhong jiang
  2018-08-02  3:52       ` Bart Van Assche
  0 siblings, 1 reply; 8+ messages in thread
From: zhong jiang @ 2018-08-02  3:29 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: andy.shevchenko@gmail.com, aacraid@microsemi.com,
	jejb@linux.vnet.ibm.com, john.garry@huawei.com,
	martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org

On 2018/8/2 11:21, Bart Van Assche wrote:
> On Thu, 2018-08-02 at 10:45 +0800, zhong jiang wrote:
>> we should not use same check in a expression. just remove one
>> of them.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>>  drivers/scsi/qlogicfas408.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
>> index 8b471a9..1409ac1 100644
>> --- a/drivers/scsi/qlogicfas408.c
>> +++ b/drivers/scsi/qlogicfas408.c
>> @@ -567,8 +567,7 @@ void qlogicfas408_setup(int qbase, int id, int int_type)
>>  int qlogicfas408_detect(int qbase, int int_type)
>>  {
>>          REG1;
>> -	return (((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7) &&
>> -	       ((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7));		
>> +	return (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7;
>>  }
> Does inb() have any side effects?
 just redundant. is it necessary for this . Maybe I miss something.

 Thanks,
 zhong jiang
> Bart.
>
>
>



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

* Re: [PATCH 2/2] scsi:qlogicfas408: remove the same check in qlogicfas408_detect
  2018-08-02  3:29     ` zhong jiang
@ 2018-08-02  3:52       ` Bart Van Assche
  2018-08-02  4:00         ` zhong jiang
  0 siblings, 1 reply; 8+ messages in thread
From: Bart Van Assche @ 2018-08-02  3:52 UTC (permalink / raw)
  To: zhongjiang@huawei.com
  Cc: andy.shevchenko@gmail.com, aacraid@microsemi.com,
	linux-scsi@vger.kernel.org, jejb@linux.vnet.ibm.com,
	linux-kernel@vger.kernel.org, john.garry@huawei.com,
	martin.petersen@oracle.com

On Thu, 2018-08-02 at 11:29 +0800, zhong jiang wrote:
> On 2018/8/2 11:21, Bart Van Assche wrote:
> > On Thu, 2018-08-02 at 10:45 +0800, zhong jiang wrote:
> > > we should not use same check in a expression. just remove one
> > > of them.
> > > 
> > > Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> > > ---
> > >  drivers/scsi/qlogicfas408.c | 3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
> > > index 8b471a9..1409ac1 100644
> > > --- a/drivers/scsi/qlogicfas408.c
> > > +++ b/drivers/scsi/qlogicfas408.c
> > > @@ -567,8 +567,7 @@ void qlogicfas408_setup(int qbase, int id, int int_type)
> > >  int qlogicfas408_detect(int qbase, int int_type)
> > >  {
> > >          REG1;
> > > -	return (((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7) &&
> > > -	       ((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7));		
> > > +	return (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7;
> > >  }
> > 
> > Does inb() have any side effects?
> 
>  just redundant. is it necessary for this . Maybe I miss something.

If doubletest.cocci came up with this patch, I think that script is
wrong and needs a thorough review.

Bart.


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

* Re: [PATCH 2/2] scsi:qlogicfas408: remove the same check in qlogicfas408_detect
  2018-08-02  3:52       ` Bart Van Assche
@ 2018-08-02  4:00         ` zhong jiang
  0 siblings, 0 replies; 8+ messages in thread
From: zhong jiang @ 2018-08-02  4:00 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: andy.shevchenko@gmail.com, aacraid@microsemi.com,
	linux-scsi@vger.kernel.org, jejb@linux.vnet.ibm.com,
	linux-kernel@vger.kernel.org, john.garry@huawei.com,
	martin.petersen@oracle.com

On 2018/8/2 11:52, Bart Van Assche wrote:
> On Thu, 2018-08-02 at 11:29 +0800, zhong jiang wrote:
>> On 2018/8/2 11:21, Bart Van Assche wrote:
>>> On Thu, 2018-08-02 at 10:45 +0800, zhong jiang wrote:
>>>> we should not use same check in a expression. just remove one
>>>> of them.
>>>>
>>>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>>>> ---
>>>>  drivers/scsi/qlogicfas408.c | 3 +--
>>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
>>>> index 8b471a9..1409ac1 100644
>>>> --- a/drivers/scsi/qlogicfas408.c
>>>> +++ b/drivers/scsi/qlogicfas408.c
>>>> @@ -567,8 +567,7 @@ void qlogicfas408_setup(int qbase, int id, int int_type)
>>>>  int qlogicfas408_detect(int qbase, int int_type)
>>>>  {
>>>>          REG1;
>>>> -	return (((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7) &&
>>>> -	       ((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7));		
>>>> +	return (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7;
>>>>  }
>>> Does inb() have any side effects?
>>  just redundant. is it necessary for this . Maybe I miss something.
> If doubletest.cocci came up with this patch, I think that script is
> wrong and needs a thorough review.
>
> Bart.
>
 Ok, Maybe I am wrong with this issue. Thank you for clarification.

 Sincerely,
 zhong jiang
>



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

end of thread, other threads:[~2018-08-02  4:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-02  2:44 [PATCH 0/2] remove double test condition zhong jiang
2018-08-02  2:45 ` [PATCH 1/2] scsi:qla1280: remove unnessary same condition check zhong jiang
2018-08-02  3:22   ` Bart Van Assche
2018-08-02  2:45 ` [PATCH 2/2] scsi:qlogicfas408: remove the same check in qlogicfas408_detect zhong jiang
2018-08-02  3:21   ` Bart Van Assche
2018-08-02  3:29     ` zhong jiang
2018-08-02  3:52       ` Bart Van Assche
2018-08-02  4:00         ` zhong jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox