Re: [PATCH] Removing ununsed variable int lo, hi, int data and int i from comedi/drivers/dt2814.c.

From: Luc Van Oostenryck
Date: Sun May 24 2020 - 08:10:54 EST


Hi,

On Sun, May 24, 2020 at 05:06:18PM +0530, Gaurav Pathak wrote:
> Silence following sparse warning:
> drivers/staging/comedi/drivers/dt2814.c: In function âdt2814_interruptâ:
> drivers/staging/comedi/drivers/dt2814.c:193:6: warning: variable âdataâ set but not used [-Wunused-but-set-variable]
> int data;
> ^~~~
> drivers/staging/comedi/drivers/dt2814.c: In function âdt2814_attachâ:
> drivers/staging/comedi/drivers/dt2814.c:232:6: warning: variable âiâ set but not used [-Wunused-but-set-variable]
> int i;
> ^

These warnings are not from sparse but simply from the compiler.

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

OK, 'data' is unused but are these 2 'inb(dev->iobase + DT2814_DATA)'
needed or not? I would guess that they're needed but I don't know
this hardware.

> @@ -241,8 +233,6 @@ 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);

Same here.

-- Luc