Message ID | 20230927153558.159278-21-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2977968vqu; Wed, 27 Sep 2023 17:08:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEb9QuwcAU+S9gcpJwBQ2ZY2e4UYWWbWVLWYid0d9y5NHEpuMk8tyaKfsmxRkkL5DeLKNlZ X-Received: by 2002:a05:6870:968b:b0:1d5:cdf7:bd95 with SMTP id o11-20020a056870968b00b001d5cdf7bd95mr4401202oaq.16.1695859720737; Wed, 27 Sep 2023 17:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695859720; cv=none; d=google.com; s=arc-20160816; b=w+7fxlAh3CRA/LonqFfzavr9oscFAI0g4tjOkBJ/PbontLVKuoXTN/xx/+d1AL3sSV tEpzQz86Jr7S87AEQ4CJMf9XFXF3W4B/3R5A+WAoXTJPp9FjL7elxxIsYEVLN3Uq5IfY BZrZQxnxKZwW+YhHApULpME1pPCKJ9O3fTrcYH8en5ljH5JDDtYQwMmbym+cyenB9wks RY5+1eC1Jlv/sk2uobplyD1kpsypbslbcWZyXGVswrhG6sEdUy+hOpschlU2oeyXz5+J jNH3cOYOjejAMQ77pgJt9vdhJFkKIG/BQthNhDuG1JSvOmJA++lyJ8OJ3fNwlbrKGbfD fo5w== 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=QphLxYjQ8pTcAvqgFGhycyeZsl9anGIME2A6zBkQp5w=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=jJvjrLAQ8+fJ520NnyQ4d/1CzhYbJ6PqI6NYISAiiVxvhMy3o6Cj2mcBReNn3oPpfG tJmIe5kVLx3L6k9Poih1qFqS/lwqXg3zliKUf5ZpEWV01QVdkfZ3edw8Tj/kWTJRkfUC m9nZ8FZaFA8YEZkiLOZqOLvtGYGj0R4qs6073YanJw4eqU4/v08+KWzaiJvmw+CNnlsl q/yLLhJEVuWF0fVKQNpZ2EQtkvRjn/elOCpKi9CBx4LEGFY5VYiK4rH78XdyykNJ5JFs Ec7TH9InlJ7RQkW+9rL+AQtrsxjAiPfxi/6Hqe/E6d4yUUgE14/AXuZ8PzYcJfdv+Ex7 ktUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=kqUQ9S0b; 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 x185-20020a6386c2000000b00578fc70f905si14855543pgd.315.2023.09.27.17.08.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 17:08:40 -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=kqUQ9S0b; 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 258E88029DCA; Wed, 27 Sep 2023 08:37:12 -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 S232897AbjI0PhI (ORCPT <rfc822;ruipengqi7@gmail.com> + 19 others); Wed, 27 Sep 2023 11:37:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232606AbjI0Pg0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 27 Sep 2023 11:36:26 -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 4639F1AC; Wed, 27 Sep 2023 08:36:18 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:672:46bd:3ec7:6cdf]) (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 BDC59660734C; Wed, 27 Sep 2023 16:36:16 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695828977; bh=nC5JveIjPzMVC1zxPduxcDxFwp3MsqPq43pscFJumwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kqUQ9S0b5mgGvycKsdnIVMdl6gR7Xdu5VBy17S2W8Hi4ie+wiGRaseU2nXp5bE2km b85t/REOouISSEEWEkdQpWiuqaBJEc7D9hgBncOUZijgVJKM6UOzMYrPmmXVO+9wu2 iyicQkSoGP2PjGvkJenK1VJhuGud77LPqs7NL3FYNMlzyvtV90N9X1fUi0+uAfdlkO 0BuNnK2v13mdnfAojusg3DlL/C0qu2I82OvUGN5G6QyqpenA0a2PpNWz8D3WjV1m7o FkjdyDdzKhvvsIkJeuv6CxsMjIBIPupCx/aJSsM0ZHBAbes3SI3pKhgtpV+j3k0NSE LwqIRGBi8cYhw== 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 v8 20/53] media: Remove duplicated index vs q->num_buffers check Date: Wed, 27 Sep 2023 17:35:25 +0200 Message-Id: <20230927153558.159278-21-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230927153558.159278-1-benjamin.gaignard@collabora.com> References: <20230927153558.159278-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]); Wed, 27 Sep 2023 08:37:12 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778237802312537815 X-GMAIL-MSGID: 1778237802312537815 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Sept. 27, 2023, 3:35 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 655133f1ae2b..9a4b11279fe7 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); @@ -834,10 +829,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); @@ -909,10 +900,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);