staging: comedi: dt2801: fix access to 2nd dio subdevice
authorH Hartley Sweeten <hartleys@visionengravers.com>
Thu, 6 Sep 2012 01:39:13 +0000 (18:39 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Sep 2012 03:03:55 +0000 (20:03 -0700)
Only 4 subdevices are allocated by this driver. The 2nd dio
subdevice is 'dev->subdevice + 3' not '... + 4'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/dt2801.c

index d332269375ab53f0230ef3f42f8ad43ac4457ce5..b6481bc3b2d8d907897aeeb4e48330009f371f44 100644 (file)
@@ -532,7 +532,7 @@ static int dt2801_dio_insn_bits(struct comedi_device *dev,
 {
        int which = 0;
 
-       if (s == dev->subdevices + 4)
+       if (s == dev->subdevices + 3)
                which = 1;
 
        if (data[0]) {
@@ -555,7 +555,7 @@ static int dt2801_dio_insn_config(struct comedi_device *dev,
 {
        int which = 0;
 
-       if (s == dev->subdevices + 4)
+       if (s == dev->subdevices + 3)
                which = 1;
 
        /* configure */