V4L/DVB (10463): radio-mr800: fix checking of retval after usb_bulk_msg
authorAlexey Klimov <klimov.linux@gmail.com>
Thu, 5 Feb 2009 12:00:03 +0000 (09:00 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:42:40 +0000 (12:42 -0300)
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>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/radio/radio-mr800.c

index 23c3c539157b9243a1bc37f43e8c51f3de9fef70..ded25bfb366e7ccc748c60bdf17ba6685f668197 100644 (file)
@@ -214,7 +214,7 @@ static int amradio_set_mute(struct amradio_device *radio, char argument)
        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;
        }
@@ -251,7 +251,7 @@ static int amradio_setfreq(struct amradio_device *radio, int freq)
        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;
        }
@@ -268,7 +268,7 @@ static int amradio_setfreq(struct amradio_device *radio, int freq)
        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;
        }