Re: [RFT 1/2] cdc-wdm: sanitize error returns

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

 



Oliver Neukum <oneukum@xxxxxxx> writes:
> Am Freitag, 27. April 2012, 17:22:06 schrieb Bjørn Mork:
>> But I have no idea which error codes are supposed to be returned and
>> which should be translated.  I can only assume the change is correct for
>> wdm_flush, but I wonder why we translate errors there and not anywhere
>> else? I still get the 
>> 
>
> My oversight. Please test.
>
> 	Regards
> 		Oliver
>
> diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
> index 6bf1a40..5ce957e 100644
> --- a/drivers/usb/class/cdc-wdm.c
> +++ b/drivers/usb/class/cdc-wdm.c
> @@ -369,6 +369,7 @@ static ssize_t wdm_write
>  	r = usb_autopm_get_interface(desc->intf);
>  	if (r < 0) {
>  		kfree(buf);
> +		rv = usb_translate_errors(r);
>  		goto outnp;
>  	}
>  
> @@ -384,6 +385,7 @@ static ssize_t wdm_write
>  
>  	if (r < 0) {
>  		kfree(buf);
> +		rv = r;
>  		goto out;
>  	}
>  
> @@ -415,6 +417,7 @@ static ssize_t wdm_write
>  		desc->outbuf = NULL;
>  		clear_bit(WDM_IN_USE, &desc->flags);
>  		dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv);
> +		rv = usb_translate_errors(rv);
>  	} else {
>  		dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d",
>  			req->wIndex);
> @@ -596,6 +599,7 @@ static int wdm_open(struct inode *inode, struct file *file)
>  			desc->count--;
>  			dev_err(&desc->intf->dev,
>  				"Error submitting int urb - %d\n", rv);
> +			rv = usb_translate_errors(rv);
>  		}
>  	} else {
>  		rv = 0;


Yes, this removes the "unknown error" problem. I guess Aleksander will
like that. Feel free to add

Tested-by: Bjørn Mork <bjorn@xxxxxxx>

if it matters.



Bjørn
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux