Re: [PATCH v3] Staging: comedi: dt2814: remove unused assignments

From: Dan Carpenter
Date: Tue May 26 2020 - 16:26:50 EST


Oh, crap. I'm really sorry but these lines of code can't be deleted.
Luc was suggesting that earlier and I saw what he said but I was sure
they could be deleted. Now that I look at it more closely I see I was
wrong.

hi = inb(dev->iobase + DT2814_DATA);
lo = inb(dev->iobase + DT2814_DATA);

Every time we read from DT2814_DATA we get different data. The first
time we get the byte and the second time we get the low byte. In other
words reading from the register has side effects so if we delete a read
then the next thing to read from there will get the data that we were
supposed to read.

What we could do instead would be to remove the "hi = " assignment.
There is one other places where the assignment is not used.

i = inb(dev->iobase + DT2814_DATA);
i = inb(dev->iobase + DT2814_DATA);

I feel really bad for not seeing this earlier. I know everyone hates
redoing patches. I certain hate redoing patches. This one was my
fault. :/ The v3 was in the right format and all, but it will cause a
bug.

regards,
dan carpenter