From patchwork Mon Dec 30 16:41:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 3420101 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 269EBC02DC for ; Mon, 30 Dec 2013 16:42:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 67D5E200DE for ; Mon, 30 Dec 2013 16:42:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B08A200DC for ; Mon, 30 Dec 2013 16:42:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756135Ab3L3Ql7 (ORCPT ); Mon, 30 Dec 2013 11:41:59 -0500 Received: from smtp205.alice.it ([82.57.200.101]:48686 "EHLO smtp205.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756010Ab3L3Ql6 (ORCPT ); Mon, 30 Dec 2013 11:41:58 -0500 Received: from jcn (87.3.146.169) by smtp205.alice.it (8.6.060.28) id 529A5931075FFCBE; Mon, 30 Dec 2013 17:41:51 +0100 Received: from ao2 by jcn with local (Exim 4.82) (envelope-from ) id 1VxfuV-0002BV-W6; Mon, 30 Dec 2013 17:41:48 +0100 From: Antonio Ospite To: linux-media@vger.kernel.org Cc: hdegoede@redhat.com, m.chehab@samsung.com, Julia Lawall , Antonio Ospite Subject: [PATCH 1/2] gspca_kinect: fix kinect_read() error path Date: Mon, 30 Dec 2013 17:41:45 +0100 Message-Id: <1388421706-8366-1-git-send-email-ospite@studenti.unina.it> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <20131230165625.814796d9e041d2261e1d078a@studenti.unina.it> References: <20131230165625.814796d9e041d2261e1d078a@studenti.unina.it> X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The error checking code relative to the invocations of kinect_read() does not return the actual return code of the function just called, it returns "res" which still contains the value of the last invocation of a previous kinect_write(). Return the proper value, and while at it also report with -EREMOTEIO the case of a partial transfer. Reported-by: Julia Lawall Signed-off-by: Antonio Ospite --- drivers/media/usb/gspca/kinect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/gspca/kinect.c b/drivers/media/usb/gspca/kinect.c index 3773a8a..48084736 100644 --- a/drivers/media/usb/gspca/kinect.c +++ b/drivers/media/usb/gspca/kinect.c @@ -158,7 +158,7 @@ static int send_cmd(struct gspca_dev *gspca_dev, uint16_t cmd, void *cmdbuf, PDEBUG(D_USBO, "Control reply: %d", res); if (actual_len < sizeof(*rhdr)) { pr_err("send_cmd: Input control transfer failed (%d)\n", res); - return res; + return actual_len < 0 ? actual_len : -EREMOTEIO; } actual_len -= sizeof(*rhdr);