From patchwork Thu Sep 6 15:23:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Senna Tschudin X-Patchwork-Id: 1415831 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id AF3FADFFCF for ; Thu, 6 Sep 2012 15:24:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757914Ab2IFPYV (ORCPT ); Thu, 6 Sep 2012 11:24:21 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:62616 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757860Ab2IFPYT (ORCPT ); Thu, 6 Sep 2012 11:24:19 -0400 Received: by wgbdr13 with SMTP id dr13so1754217wgb.1 for ; Thu, 06 Sep 2012 08:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=8QSy2KqyHpKCNjnaHN5uW8G3rz7VE2u/o09Gz7JvGqw=; b=bd/YFmdRQM/EPFqou3P9tNGh9cv6I688HLne32EywaIRROVvo5+DRKzefK92qdZcXU eEBNwsa8bw8RYJ3945BMxprRIibsh1Ke0e7+RGbC3kfzYcOLzOg77L4qguB1gxgam95f OpeYIFRxRWLBjf/sVk8r/Luwy4FUDZ4hSJFmw+g+65P0RAhfeaBMCoR7nCV+zYLsbLxr 1PHRIwn8zl8RdKrLSYr6f2+tuCSRVY15kQv0PFwB2xMjULzehgJGGVwhWQnXzh0Yj4td G1YkWoh4E+QtK9isSUSvk9mUd4qbavhRR/6HPMgB2MoAun1b/YZD9pWtOZSiG9cx5mm2 KdxQ== Received: by 10.216.209.8 with SMTP id r8mr1521253weo.51.1346945057908; Thu, 06 Sep 2012 08:24:17 -0700 (PDT) Received: from localhost.localdomain ([132.227.100.38]) by mx.google.com with ESMTPS id el6sm4572331wib.8.2012.09.06.08.24.17 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 06 Sep 2012 08:24:17 -0700 (PDT) From: Peter Senna Tschudin To: Mauro Carvalho Chehab Cc: kernel-janitors@vger.kernel.org, Julia.Lawall@lip6.fr, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/14] drivers/media/v4l2-core/videobuf2-core.c: fix error return code Date: Thu, 6 Sep 2012 17:23:57 +0200 Message-Id: <1346945041-26676-10-git-send-email-peter.senna@gmail.com> X-Mailer: git-send-email 1.7.11.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Peter Senna Tschudin Convert a nonnegative error return code to a negative one, as returned elsewhere in the function. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // Signed-off-by: Peter Senna Tschudin --- drivers/media/v4l2-core/videobuf2-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 4da3df6..f6bc240 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -1876,8 +1876,10 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read) */ for (i = 0; i < q->num_buffers; i++) { fileio->bufs[i].vaddr = vb2_plane_vaddr(q->bufs[i], 0); - if (fileio->bufs[i].vaddr == NULL) + if (fileio->bufs[i].vaddr == NULL) { + ret = -EFAULT; goto err_reqbufs; + } fileio->bufs[i].size = vb2_plane_size(q->bufs[i], 0); }