From patchwork Wed Feb 5 18:58:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sensoray-dev X-Patchwork-Id: 3588641 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6B20B9F392 for ; Wed, 5 Feb 2014 19:46:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E9EB20149 for ; Wed, 5 Feb 2014 19:46:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC16C20127 for ; Wed, 5 Feb 2014 19:46:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751525AbaBETqv (ORCPT ); Wed, 5 Feb 2014 14:46:51 -0500 Received: from gateway07.websitewelcome.com ([67.18.62.18]:45074 "EHLO gateway07.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbaBETqu (ORCPT ); Wed, 5 Feb 2014 14:46:50 -0500 X-Greylist: delayed 1500 seconds by postgrey-1.27 at vger.kernel.org; Wed, 05 Feb 2014 14:46:50 EST Received: by gateway07.websitewelcome.com (Postfix, from userid 5007) id 4D9C6953418AA; Wed, 5 Feb 2014 12:58:25 -0600 (CST) Received: from gator3086.hostgator.com (ns6171.hostgator.com [50.87.144.121]) by gateway07.websitewelcome.com (Postfix) with ESMTP id 35CF295341868 for ; Wed, 5 Feb 2014 12:58:25 -0600 (CST) Received: from [50.43.67.108] (port=57855 helo=localhost.localdomain) by gator3086.hostgator.com with esmtpa (Exim 4.80) (envelope-from ) id 1WB7g0-0005i1-D9; Wed, 05 Feb 2014 12:58:24 -0600 From: Dean Anderson To: hverkuil@xs4all.nl, linux-dev@sensoray.com, linux-media@vger.kernel.org Subject: [PATCH v2] s2255drv: fix for return code not checked Date: Wed, 5 Feb 2014 10:58:20 -0800 Message-Id: <1391626700-4729-1-git-send-email-linux-dev@sensoray.com> X-Mailer: git-send-email 1.7.9.5 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3086.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - sensoray.com X-BWhitelist: no X-Source-IP: 50.43.67.108 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (localhost.localdomain) [50.43.67.108]:57855 X-Source-Auth: dean@sensoray.com X-Email-Count: 13 X-Source-Cap: c2Vuc29yYXk7c2Vuc29yYXk7Z2F0b3IzMDg2Lmhvc3RnYXRvci5jb20= 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.4 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 Start acquisition return code was not being checked. Return error if start acquisition fails. Signed-off-by: Dean Anderson --- drivers/media/usb/s2255/s2255drv.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 4c483ad..787b591 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -1230,12 +1230,16 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) vc->buffer.frame[j].cur_size = 0; } res = videobuf_streamon(&fh->vb_vidq); - if (res == 0) { - s2255_start_acquire(vc); - vc->b_acquire = 1; - } else + if (res != 0) { res_free(fh); - + return res; + } + res = s2255_start_acquire(vc); + if (res != 0) { + res_free(fh); + return res; + } + vc->b_acquire = 1; return res; } @@ -2373,7 +2377,7 @@ static int s2255_start_acquire(struct s2255_vc *vc) dprintk(dev, 2, "start acquire exit[%d] %d\n", vc->idx, res); mutex_unlock(&dev->cmdlock); - return 0; + return res; } static int s2255_stop_acquire(struct s2255_vc *vc)