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: 21389 X-Patchwork-Delegate: hdegoede@redhat.com Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Vxful-0008GW-KV; Mon, 30 Dec 2013 17:42:03 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-8) with esmtp id 1Vxfuj-0006G5-jS; Mon, 30 Dec 2013 17:42:02 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756135Ab3L3Ql7 (ORCPT + 1 other); 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-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.12.30.163315 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1200_1299 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __SUBJ_ALPHA_NEGATE 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' 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);