All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch review 9/8] radio-mr800: fix checking of retval after usb_bulk_msg
@ 2009-02-04 20:56 Alexey Klimov
  0 siblings, 0 replies; only message in thread
From: Alexey Klimov @ 2009-02-04 20:56 UTC (permalink / raw)
  To: Douglas Schilling Landgraf; +Cc: linux-media

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 -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;
 	}



-- 
Best regards, Klimov Alexey


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-04 20:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-04 20:56 [patch review 9/8] radio-mr800: fix checking of retval after usb_bulk_msg Alexey Klimov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.