From patchwork Wed Feb 4 20:56:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 5515 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n14KuGC6026125 for ; Wed, 4 Feb 2009 20:56:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753559AbZBDU4P (ORCPT ); Wed, 4 Feb 2009 15:56:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754735AbZBDU4P (ORCPT ); Wed, 4 Feb 2009 15:56:15 -0500 Received: from fg-out-1718.google.com ([72.14.220.157]:24249 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755007AbZBDU4O (ORCPT ); Wed, 4 Feb 2009 15:56:14 -0500 Received: by fg-out-1718.google.com with SMTP id 16so1346367fgg.17 for ; Wed, 04 Feb 2009 12:56:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=rGYwlvosvs7dgkPlcOvIb3+GleuvFt2UnjvNk8tTOUU=; b=ibOYFh+DmqWTf7jnnUwg9t0b7yNVNw6zQ08FJ0244qlqTbyzXHkd0uq8kQPSkU0Si+ q9E5uPXmnR/kcd/9JG6QCQ7RUqZlPJZkPete7F8cn7Ml4TJk0FoitDFCw97jte8tQnBw 67YEG1AusIRWfJhcaHiJZJceDAC3wh3XoY+iE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=JvYM/F7uaebNQtLS1Wb0xrbKgDhNEqy6DOAz6C7416qfxk+29Rx/smm2oUwzvVkT+H Ydi1qMR6BBwMj3aMw9fVIg9oH/1E02FyS9QWQegYrN8l9C6aa0rmfjjsn7uBo7KeacpQ whfR3DMaW+x1Zxi5mspG7c+6AduOa09E+nGeg= Received: by 10.86.51.2 with SMTP id y2mr161216fgy.75.1233780969829; Wed, 04 Feb 2009 12:56:09 -0800 (PST) Received: from ?192.168.1.42? (gw.zunet.ru [217.67.117.64]) by mx.google.com with ESMTPS id l19sm3592543fgb.57.2009.02.04.12.56.08 (version=SSLv3 cipher=RC4-MD5); Wed, 04 Feb 2009 12:56:09 -0800 (PST) Subject: [patch review 9/8] radio-mr800: fix checking of retval after usb_bulk_msg From: Alexey Klimov To: Douglas Schilling Landgraf Cc: linux-media@vger.kernel.org Date: Wed, 04 Feb 2009 23:56:13 +0300 Message-Id: <1233780973.2038.254.camel@tux.localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.24.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 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; }