diff mbox

[review,9/8] radio-mr800: fix checking of retval after usb_bulk_msg

Message ID 1233780973.2038.254.camel@tux.localhost (mailing list archive)
State Accepted
Headers show

Commit Message

Alexey Klimov Feb. 4, 2009, 8:56 p.m. UTC
Patch corrects checking of returned value after usb_bulk_msg. Now we
also check if number of transferred bytes equals to BUFFER_LENGTH.

Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>

--
diff mbox

Patch

diff -r 2876e91adef9 linux/drivers/media/radio/radio-mr800.c
--- a/linux/drivers/media/radio/radio-mr800.c	Wed Feb 04 21:38:46 2009 +0300
+++ b/linux/drivers/media/radio/radio-mr800.c	Wed Feb 04 22:52:15 2009 +0300
@@ -217,7 +217,7 @@ 
 	retval = usb_bulk_msg(radio->usbdev, usb_sndintpipe(radio->usbdev, 2),
 		(void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT);
 
-	if (retval) {
+	if (retval < 0 || size != BUFFER_LENGTH) {
 		mutex_unlock(&radio->lock);
 		return retval;
 	}
@@ -254,7 +254,7 @@ 
 	retval = usb_bulk_msg(radio->usbdev, usb_sndintpipe(radio->usbdev, 2),
 		(void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT);
 
-	if (retval) {
+	if (retval < 0 || size != BUFFER_LENGTH) {
 		mutex_unlock(&radio->lock);
 		return retval;
 	}
@@ -271,7 +271,7 @@ 
 	retval = usb_bulk_msg(radio->usbdev, usb_sndintpipe(radio->usbdev, 2),
 		(void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT);
 
-	if (retval) {
+	if (retval < 0 || size != BUFFER_LENGTH) {
 		mutex_unlock(&radio->lock);
 		return retval;
 	}