LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] staging: comedi: drivers: dt2814: Removed variables that is never used
@ 2015-01-28 22:33 Rickard Strandqvist
  2015-01-29 12:52 ` Ian Abbott
  0 siblings, 1 reply; 3+ messages in thread
From: Rickard Strandqvist @ 2015-01-28 22:33 UTC (permalink / raw)
  To: Ian Abbott, H Hartley Sweeten
  Cc: Rickard Strandqvist, Greg Kroah-Hartman, devel, linux-kernel

Variable ar assigned a value that is never used.
I have also removed all the code that thereby serves no purpose.

This was found using a static code analysis program called cppcheck

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/staging/comedi/drivers/dt2814.c |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c
index 9805be1..d2e7a4e 100644
--- a/drivers/staging/comedi/drivers/dt2814.c
+++ b/drivers/staging/comedi/drivers/dt2814.c
@@ -198,21 +198,17 @@ static int dt2814_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 
 static irqreturn_t dt2814_interrupt(int irq, void *d)
 {
-	int lo, hi;
 	struct comedi_device *dev = d;
 	struct dt2814_private *devpriv = dev->private;
 	struct comedi_subdevice *s = dev->read_subdev;
-	int data;
 
 	if (!dev->attached) {
 		dev_err(dev->class_dev, "spurious interrupt\n");
 		return IRQ_HANDLED;
 	}
 
-	hi = inb(dev->iobase + DT2814_DATA);
-	lo = inb(dev->iobase + DT2814_DATA);
-
-	data = (hi << 4) | (lo >> 4);
+	inb(dev->iobase + DT2814_DATA);
+	inb(dev->iobase + DT2814_DATA);
 
 	if (!(--devpriv->ntrig)) {
 		int i;
@@ -239,7 +235,6 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 	struct dt2814_private *devpriv;
 	struct comedi_subdevice *s;
 	int ret;
-	int i;
 
 	ret = comedi_request_region(dev, it->options[0], 0x2);
 	if (ret)
@@ -251,8 +246,8 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 		dev_err(dev->class_dev, "reset error (fatal)\n");
 		return -EIO;
 	}
-	i = inb(dev->iobase + DT2814_DATA);
-	i = inb(dev->iobase + DT2814_DATA);
+	inb(dev->iobase + DT2814_DATA);
+	inb(dev->iobase + DT2814_DATA);
 
 	if (it->options[1]) {
 		ret = request_irq(it->options[1], dt2814_interrupt, 0,
-- 
1.7.10.4


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

* Re: [PATCH] staging: comedi: drivers: dt2814: Removed variables that is never used
  2015-01-28 22:33 [PATCH] staging: comedi: drivers: dt2814: Removed variables that is never used Rickard Strandqvist
@ 2015-01-29 12:52 ` Ian Abbott
  2015-01-29 13:01   ` Ian Abbott
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Abbott @ 2015-01-29 12:52 UTC (permalink / raw)
  To: Rickard Strandqvist, H Hartley Sweeten
  Cc: Greg Kroah-Hartman, devel, linux-kernel

On 28/01/15 22:33, Rickard Strandqvist wrote:
> Variable ar assigned a value that is never used.
> I have also removed all the code that thereby serves no purpose.
>
> This was found using a static code analysis program called cppcheck
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
>   drivers/staging/comedi/drivers/dt2814.c |   13 ++++---------
>   1 file changed, 4 insertions(+), 9 deletions(-)

Good, apart from the bad English!

Reviewed-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

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

* Re: [PATCH] staging: comedi: drivers: dt2814: Removed variables that is never used
  2015-01-29 12:52 ` Ian Abbott
@ 2015-01-29 13:01   ` Ian Abbott
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Abbott @ 2015-01-29 13:01 UTC (permalink / raw)
  To: Rickard Strandqvist, H Hartley Sweeten
  Cc: Greg Kroah-Hartman, devel, linux-kernel

On 29/01/15 12:52, Ian Abbott wrote:
> On 28/01/15 22:33, Rickard Strandqvist wrote:
>> Variable ar assigned a value that is never used.
>> I have also removed all the code that thereby serves no purpose.
>>
>> This was found using a static code analysis program called cppcheck
>>
>> Signed-off-by: Rickard Strandqvist
>> <rickard_strandqvist@spectrumdigital.se>
>> ---
>>   drivers/staging/comedi/drivers/dt2814.c |   13 ++++---------
>>   1 file changed, 4 insertions(+), 9 deletions(-)
>
> Good, apart from the bad English!
>
> Reviewed-by: Ian Abbott <abbotti@mev.co.uk>

On second thoughts, I retract my 'Reviewed-by'. The patch actually 
serves to point out a glaring bug in the original code, in that it 
acquires data in the interrupt routine but just throws it all away!

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

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

end of thread, other threads:[~2015-01-29 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28 22:33 [PATCH] staging: comedi: drivers: dt2814: Removed variables that is never used Rickard Strandqvist
2015-01-29 12:52 ` Ian Abbott
2015-01-29 13:01   ` Ian Abbott

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).