driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Gaurav Pathak <gauravpathak129@gmail.com>
Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, abbotti@mev.co.uk,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: Re: [PATCH v3] Staging: comedi: dt2814: remove unused assignments
Date: Tue, 26 May 2020 23:24:25 +0300	[thread overview]
Message-ID: <20200526202425.GH22511@kadam> (raw)
In-Reply-To: <20200526185130.7160-1-gauravpathak129@gmail.com>

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

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

      reply	other threads:[~2020-05-26 20:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-24 11:36 [PATCH] Removing ununsed variable int lo, hi, int data and int i from comedi/drivers/dt2814.c Gaurav Pathak
2020-05-24 12:10 ` Luc Van Oostenryck
2020-05-24 12:49   ` GAURAV PATHAK
2020-05-24 13:58     ` Luc Van Oostenryck
2020-05-24 13:32   ` GAURAV PATHAK
2020-05-24 14:08     ` Luc Van Oostenryck
2020-05-26 14:13 ` Dan Carpenter
2020-05-26 14:54   ` GAURAV PATHAK
2020-05-26 15:09     ` Dan Carpenter
2020-05-26 15:50       ` [PATCH v2] Staging: comedi: dt2814: remove unused assignments gaurav
2020-05-26 18:21         ` Dan Carpenter
2020-05-26 18:51           ` [PATCH v3] " Gaurav Pathak
2020-05-26 20:24             ` Dan Carpenter [this message]

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=20200526202425.GH22511@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=abbotti@mev.co.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=gauravpathak129@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).