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

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

 



On Tuesday, December 10, 2013 3:28 PM, Dan Carpenter wrote:
> On Tue, Dec 10, 2013 at 09:30:43PM +0000, Ian Abbott wrote:
>> 
>> 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.
>> 
>
> Yeah.  It looks like it's usbduxfast_upload_firmware() which has the
 >problem.  Does this fix your problem?  This bug was introduced in
> 161f440c8d91 ('staging: comedi: drivers: usbduxfast.c: fix for DMA
> buffers on stack')

Actually I think I broke it when I introduced the comedi_upload_firmware()
helper and converted the usbdux drivers to use it.

> diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c
> index 9707dd1239c4..f2d8d7fb7aab 100644
> --- a/drivers/staging/comedi/drivers/usbduxfast.c
> +++ b/drivers/staging/comedi/drivers/usbduxfast.c
> @@ -1040,6 +1040,7 @@ static int usbduxfast_upload_firmware(struct comedi_device *dev,
>  			      EZTIMEOUT);
>  	if (ret < 0)
>  		dev_err(dev->class_dev, "can not start firmware\n");
> +	ret = 0;
>  
>  done:
>  	kfree(tmp);

This would only fix the usbduxfast driver.

I think Ian's comment about fixing comedi_load_firmware() is the correct
one.  This should do it:


>From dcb9cae663fb7489e235569de20ac5757450953d Mon Sep 17 00:00:00 2001
From: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 18 Jun 2013 13:21:13 -0700
Subject: [PATCH] staging: comedi: drivers: fix return value of
 comedi_load_firmware()

Some of the callback functions that upload the firmware in the comedi
drivers return a positive value indicating the number of bytes sent
to the device. Detect this condition and just return '0' to indicate
a successful upload.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Bernd Porr <mail@xxxxxxxxxxxxxxx>
Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
 drivers/staging/comedi/drivers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index a5d03b9..9d71b4d 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -451,7 +451,7 @@ int comedi_load_firmware(struct comedi_device *dev,
 		release_firmware(fw);
 	}
 
-	return ret;
+	return ret < 0 ? ret : 0;
 }
 EXPORT_SYMBOL_GPL(comedi_load_firmware);
 
-- 
1.8.4.4


_______________________________________________
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