Re: staging: comedi: USB devs not working / some comedi core reorganization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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<mail@xxxxxxxxxxxxxxx>
---
  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.

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux