staging: comedi: usbduxsigma: return failure of auto attach
authorBernd Porr <mail@berndporr.me.uk>
Tue, 7 Jan 2014 21:43:10 +0000 (21:43 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2014 18:51:54 +0000 (10:51 -0800)
The function usbduxsigma_getstatusinfo() returns a negative
value in case there has been a communication error with
the board. This should always work and if this communication
fails then there is something seriously wrong with the board.
This is now returned to the caller so that it can
terminte the auto attachement. The return command also prevents
printing out the offset value in case of a fault.

Signed-off-by: Bernd Porr <mail@berndporr.me.uk>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/usbduxsigma.c

index 194c686c5a424018c7b194941897e574101d7b55..ff521b3a07d0bd412f5052d95074ddc6f6fcac54 100644 (file)
@@ -1655,9 +1655,11 @@ static int usbduxsigma_auto_attach(struct comedi_device *dev,
        }
 
        offset = usbduxsigma_getstatusinfo(dev, 0);
-       if (offset < 0)
+       if (offset < 0) {
                dev_err(dev->class_dev,
-                       "Communication to USBDUXSIGMA failed! Check firmware and cabling\n");
+                       "Communication to USBDUXSIGMA failed! Check firmware and cabling.\n");
+               return offset;
+       }
 
        dev_info(dev->class_dev, "attached, ADC_zero = %x\n", offset);