Message ID | 20231017144756.34719-7-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4186755vqb; Tue, 17 Oct 2023 07:48:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHNpsem1ekfnYPi+eZvtF/i0gU/EpoFL6Tt529x7xUer47pnxb+WyFDLm+3gt/whAd21KlA X-Received: by 2002:a05:6a00:1ca1:b0:6b3:c72d:b01 with SMTP id y33-20020a056a001ca100b006b3c72d0b01mr2488087pfw.1.1697554123832; Tue, 17 Oct 2023 07:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697554123; cv=none; d=google.com; s=arc-20160816; b=ON8E0sX7jNG23J1DEp4kdqKz8xufM5m/Q45FfYvuGD44BS1iPGt7T3JwdhqCWCQeDX 7BNot2B538pgzUIyE3Wl44ZJg4visl3w1nmn9FXPfQNwSex/lgEBDe8oDehzICK1GsKN rJy4sd8rmrcRYLi7Lh0YHfMBNlRbuhCqXA4R61l/N181ovDIg5p0OP6PJVzLsBp8dBaS 9sg6o4Q3sxKdDQJ7Frl+wxjzTZil4fbYgNM2HHwhTaYANLRjtwLgBoB+qRr1dfM7NC+w allcmZa+Jo+NZCGz5FxiUoallTgba5pff8BUyKhSrQAfxn2kAehxTLmFPgMO9/x2mIBO lRpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Y6AR+miMPP121mWIcGoHC27lbGw2XaVJcw9mhisXWqg=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=pB9NBLiZbWfrDtj39cZ6Z423gRPs+aSUBleBXQDlzntsbcARPuZWC7svAPfgOcTn51 DqUUB3aAESVj+wK+bXzL0gATk5zR9hKvPX5LbUhtVa6zOfjbu58M/iifqqLiczxypHkw EemrH9yEnBQnq7Q5Ohy9YwUiVd4LjxJqnhhC4XUNTH/r7FJZl8yFTVcTBo1FwqB1pIMS GY5K2vViLUUA0K+TaClfw4LqeRBHAxO5KMi8chp2dBpK1Y//NwLwSptt9V+TFY+e8AB7 GUR17bOWurzap5f0pcy23ZrDGzRXS095kN8kOpXINEA/QIazoIuTIjJwuG/7MuVBdfKw 2T1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=DVBKAU0q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id cm19-20020a056a020a1300b0056fa1ac3722si1987431pgb.698.2023.10.17.07.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 07:48:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=DVBKAU0q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5BBAB80E06A1; Tue, 17 Oct 2023 07:48:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344272AbjJQOs2 (ORCPT <rfc822;hjfbswb@gmail.com> + 20 others); Tue, 17 Oct 2023 10:48:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344123AbjJQOsJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 17 Oct 2023 10:48:09 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D68A6F1; Tue, 17 Oct 2023 07:48:07 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:7205:da49:a7e8:59f8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id 537C16607314; Tue, 17 Oct 2023 15:48:06 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697554086; bh=u0/tUxGMIK/59pYU6cqm9FB8VhmlcNZDctLEaz6jcAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DVBKAU0qyLGnm0hA1g9vDJuFAS8upw97fIvqg/STLHPX+UHeqfVhp0/IVoljsNowL Rnjh2Ty7MvGJzJHYRfpAskb3PhnWmPWuuGCkuZ0vwx+MItZsdHa5HhSWDJF6RSF/eg ctStQKpRk0hlSm/Xhiq9TqVp1D+G08jbqd3tsa+XRwkwrjfmbsoQs/UAjmdT6M9cY1 +9Ol7nxVxjYXKbidQ4AdOsZdtPgeng7c8cNE0J/X4V4NqAlJEIR+DJoS+woVhzQ7cF 6yxXedJ1B0wt1Lc1U7dQQOGCPlSZoF/GXz8/6G+k9chs4LpO+HTsa9iDHvUz7dUIn6 pCR9+hxq3AljA== From: Benjamin Gaignard <benjamin.gaignard@collabora.com> To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, hverkuil-cisco@xs4all.nl, nicolas.dufresne@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, kernel@collabora.com, Benjamin Gaignard <benjamin.gaignard@collabora.com> Subject: [PATCH v12 06/56] media: videobuf2: Remove duplicated index vs q->num_buffers check Date: Tue, 17 Oct 2023 16:47:06 +0200 Message-Id: <20231017144756.34719-7-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231017144756.34719-1-benjamin.gaignard@collabora.com> References: <20231017144756.34719-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 17 Oct 2023 07:48:41 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780014513241081019 X-GMAIL-MSGID: 1780014513241081019 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 17, 2023, 2:47 p.m. UTC
vb2_get_buffer() already checks if the requested index is valid.
Stop duplicating this kind of check everywhere.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
drivers/media/common/videobuf2/videobuf2-v4l2.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c index 2ffb097bf00a..c6ebc8d2c537 100644 --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c @@ -823,10 +823,6 @@ int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev, return -EBUSY; } - if (b->index >= q->num_buffers) { - dprintk(q, 1, "buffer index out of range\n"); - return -EINVAL; - } vb = vb2_get_buffer(q, b->index); if (!vb) { dprintk(q, 1, "can't find the requested buffer %u\n", b->index); @@ -898,10 +894,6 @@ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb) { struct vb2_buffer *vb; - if (eb->index >= q->num_buffers) { - dprintk(q, 1, "buffer index out of range\n"); - return -EINVAL; - } vb = vb2_get_buffer(q, eb->index); if (!vb) { dprintk(q, 1, "can't find the requested buffer %u\n", eb->index);