Good point. Nobody cares really how many bytes the firmware uploader sends to the DUX-board.

/Bernd

On 10/12/13 21:30, Ian Abbott wrote:
On 2013-12-10 21:07, Bernd Porr wrote:
Date: Tue, 10 Dec 2013 19:42:13 +0000
Subject: [PATCH 1/1] comedi_load_firmware returns the number of
transmitted
  bytes to the USB controller. The result is negative on failure.
Thus, the ret
  argument needs to be checked if negative.

Signed-off-by: Bernd Porr<m...@berndporr.me.uk>
---
  drivers/staging/comedi/drivers/usbduxfast.c  | 2 +-
  drivers/staging/comedi/drivers/usbduxsigma.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxfast.c
b/drivers/staging/comedi/drivers/usbduxfast.c
index 9707dd1..4b7f360 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -1092,7 +1092,7 @@ static int usbduxfast_auto_attach(struct
comedi_device *dev,

      ret = comedi_load_firmware(dev, &usb->dev, FIRMWARE,
                     usbduxfast_upload_firmware, 0);
-    if (ret)
+    if (ret < 0)
          return ret;

      return usbduxfast_attach_common(dev);
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c
b/drivers/staging/comedi/drivers/usbduxsigma.c
index a5363de..4ee6271 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -1596,7 +1596,7 @@ static int usbduxsigma_auto_attach(struct
comedi_device *dev,

      ret = comedi_load_firmware(dev, &usb->dev, FIRMWARE,
                     usbduxsigma_firmware_upload, 0);
-    if (ret)
+    if (ret < 0)
          return ret;

      ret = comedi_alloc_subdevices(dev, (devpriv->high_speed) ? 4 : 3);
-- 1.8.5.1

It might be better just to prevent comedi_load_firmware() returning a
value greater than zero, since I can't think of any reason why it would
need to.  That would also work for the usbdux driver.


--
www:    http://www.berndporr.me.uk/
        http://www.linux-usb-daq.co.uk/
        http://www.imdb.com/name/nm3293421/
Mobile: +44 (0)7840 340069
Work:   +44 (0)141 330 5237
        University of Glasgow
        School of Engineering
        Rankine Building, Oakfield Avenue,
        Glasgow, G12 8LT
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to