2012-05-07 10:46:04

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: drivers: Probable misuses of ||

Malcolm,

Em 04-04-2012 20:00, Joe Perches escreveu:
> Likely these should be && not ||
>
> drivers/scsi/FlashPoint.c: if(bit_cnt != 0 || bit_cnt != 8)

> drivers/media/dvb/dvb-usb/it913x.c: if (ret == 0 || ret != -EBUSY || ret != -ETIMEDOUT)
> drivers/media/dvb/dvb-usb/it913x.c: if (ret == 0 || ret != -EBUSY || ret != -ETIMEDOUT)

Could you please take a look on the above?

Thanks!
Mauro

> drivers/media/rc/fintek-cir.c: if ((chip != 0x0408) || (chip != 0x0804))
>
>


2012-05-07 15:23:14

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH] re: drivers: Probable misuses of || - it913x.c

On Mon, 2012-05-07 at 07:45 -0300, Mauro Carvalho Chehab wrote:
> Malcolm,
>
> Em 04-04-2012 20:00, Joe Perches escreveu:
> > Likely these should be && not ||
> >
> > drivers/scsi/FlashPoint.c: if(bit_cnt != 0 || bit_cnt != 8)
>
> > drivers/media/dvb/dvb-usb/it913x.c: if (ret == 0 || ret != -EBUSY || ret != -ETIMEDOUT)
> > drivers/media/dvb/dvb-usb/it913x.c: if (ret == 0 || ret != -EBUSY || ret != -ETIMEDOUT)
>
> Could you please take a look on the above?

Hmm... yes, thanks, also a bug.

Just check for -EBUSY && -ETIMEDOUT

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/media/dvb/dvb-usb/it913x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/it913x.c b/drivers/media/dvb/dvb-usb/it913x.c
index 482d249..6244fe9 100644
--- a/drivers/media/dvb/dvb-usb/it913x.c
+++ b/drivers/media/dvb/dvb-usb/it913x.c
@@ -81,7 +81,7 @@ static int it913x_bulk_write(struct usb_device *dev,
for (i = 0; i < IT913X_RETRY; i++) {
ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, pipe),
snd, len , &actual_l, IT913X_SND_TIMEOUT);
- if (ret == 0 || ret != -EBUSY || ret != -ETIMEDOUT)
+ if (ret != -EBUSY && ret != -ETIMEDOUT)
break;
}

@@ -99,7 +99,7 @@ static int it913x_bulk_read(struct usb_device *dev,
for (i = 0; i < IT913X_RETRY; i++) {
ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, pipe),
rev, len , &actual_l, IT913X_RCV_TIMEOUT);
- if (ret == 0 || ret != -EBUSY || ret != -ETIMEDOUT)
+ if (ret != -EBUSY && ret != -ETIMEDOUT)
break;
}

--
1.7.9.5