diff mbox series

[2/2] scsi:qlogicfas408: remove the same check in qlogicfas408_detect

Message ID 1533177901-19514-3-git-send-email-zhongjiang@huawei.com (mailing list archive)
State Rejected
Headers show
Series remove double test condition | expand

Commit Message

zhong jiang Aug. 2, 2018, 2:45 a.m. UTC
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(-)

Comments

Bart Van Assche Aug. 2, 2018, 3:21 a.m. UTC | #1
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.
zhong jiang Aug. 2, 2018, 3:29 a.m. UTC | #2
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.
>
>
>
Bart Van Assche Aug. 2, 2018, 3:52 a.m. UTC | #3
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.
zhong jiang Aug. 2, 2018, 4 a.m. UTC | #4
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
>
diff mbox series

Patch

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;
 }
 
 /*