Message ID | 20231002120617.119602-21-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:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1736329vqb; Mon, 2 Oct 2023 15:55:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE0rMhju9B4JrZS91SZrzN/NFzJGrT4xiwKH5PD6Gddep73CZtiAmcGR1+myJN6296JrIYk X-Received: by 2002:a67:eb88:0:b0:452:8dfc:4672 with SMTP id e8-20020a67eb88000000b004528dfc4672mr11666079vso.4.1696287328162; Mon, 02 Oct 2023 15:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696287328; cv=none; d=google.com; s=arc-20160816; b=vY4QNk6YuUHJ+fcb08ClV3iczKGSbrAgta/0GSpeJK8cyeQGqUDVFoffnHhRSpvuKd Egd2Qi6X1CImX8QI8vSNskM7XfAsUKQBaJ8zDnqjj098hUPJ+eGHOo9cZDfQKneKu56p nSo7RaA79xRpu4sT+uIMnRrIjyygpsyEsoY+rHP7WVKo6I0FhbgPbX0cHVE0iZiqJq3l lp/RN82haBE+mn6ZgwJSkCIH6FQSe/qk4rNQLIq4yoHRAmtdnITtPvAU+FaqnFLaRJHP DALpblaKW/Kdv6zEn5c5sPZ4g3vYelBYer2PRZuwREczbYkAsSF07aRrPIDm8CHG2oi+ dgfg== 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=5xy6ulbgeM0AXpFjPT8iDRlOuwuMKx6m/ngwiUulPb0=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=M8rg9aFRZplkdywBDA2zAcWiN4Q7BtCGcVpfHbLLzNkE8NaFg0LdXv7HT4Mng83uqu m5CnUUADwNr7ZMkhrFzmZB1DyhG0XfxOE4/9/YdZJqJ46xZOSkzNLMjmoEf4GJoh01o+ R2H9XFhMQVhsJCPBvkltInwQZ114ezJXfaPOF0RK4lVLQAzxac7aSuTMMH+WY/Sd0gTZ kYn8t2xjrNrqQ43PX3F1KmlzipXX1BA+EWEJKTNhvGKF46CauCnoH1i+izVn2SvR0E5U YIUm39snP475saPxj/oyFmQL+/Iiod/OxOCMvKz7FWaetCX7vxaimBVGnaazn4CwS+mA X/Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GArcyLDY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bz41-20020a056a02062900b00578cbee11easi11305878pgb.9.2023.10.02.15.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 15:55:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=GArcyLDY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 71D98812DBEA; Mon, 2 Oct 2023 05:07:48 -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 S237100AbjJBMHa (ORCPT <rfc822;pusanteemu@gmail.com> + 18 others); Mon, 2 Oct 2023 08:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237057AbjJBMGj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 2 Oct 2023 08:06:39 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CA45D7; Mon, 2 Oct 2023 05:06:36 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:9537:67ca:c85e:d0ae]) (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 2176C66071CC; Mon, 2 Oct 2023 13:06:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696248395; bh=1dskbbkJ3zkcIpXG7ctqvahZ8PrAeLCG0dqn3ErBFLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GArcyLDYSkfOg/bRKLRtfDV9Evg/+21CqpgAh6HhTBGfXQIGHHUuS/XCWsQnf/7i9 CSaGi7Jt1IK1NGij2mJXYpy281QKk8QUVguf0acAhCQQdzvUpAFbFEpk2qd68oMbI2 BKg3BmMVWXHJXJKRGE6jViuJ1u2Brp+QeeLc4TE5RksfLxqV8c7XBHa4gs/PBsZ2nM tiE8AbIfCXlnFgAlotVblXispb6RehFvXjviSmLA3Jvfwnu23j74teo2SQPFWqHRg2 rwcQTJJ+et+PYC2ylLZF4sBFrpD0cfGk3RIDo57rRlzVCDm6MM7NmYTzSjufTd2yME Q8KRX6Sh721yA== 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 v9 20/53] media: Remove duplicated index vs q->num_buffers check Date: Mon, 2 Oct 2023 14:05:44 +0200 Message-Id: <20231002120617.119602-21-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002120617.119602-1-benjamin.gaignard@collabora.com> References: <20231002120617.119602-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,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]); Mon, 02 Oct 2023 05:07:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778686181316169573 X-GMAIL-MSGID: 1778686181316169573 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 2, 2023, 12:05 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 | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c index 51b16cd14582..38eef0c5d18c 100644 --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c @@ -378,11 +378,6 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *md return -EINVAL; } - if (b->index >= q->num_buffers) { - dprintk(q, 1, "%s: buffer index out of range\n", opname); - return -EINVAL; - } - vb = vb2_get_buffer(q, b->index); if (!vb) { dprintk(q, 1, "%s: buffer %u is NULL\n", opname, b->index); @@ -833,10 +828,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); @@ -908,10 +899,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);