From patchwork Thu Oct 19 12:51:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 155534 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp360752vqb; Thu, 19 Oct 2023 05:56:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4LdFD+n3Jx9Ap9viy8L+3tcbvFRmT3dc4pvpDC/57Z691rplIfgpLafvmWyWYBBbsRZEd X-Received: by 2002:a05:6a00:21c8:b0:6b8:69fa:a11 with SMTP id t8-20020a056a0021c800b006b869fa0a11mr1940828pfj.12.1697720218444; Thu, 19 Oct 2023 05:56:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697720218; cv=none; d=google.com; s=arc-20160816; b=m9jbraa2JcM3cJTOaxentJQmFwXJtL2AUGL8onfp+7eu/dmkp6++PIqsGoQ16F9jzh mbh22Ega0FbfgSmqBGi4d2JwFKRrU4YUUANte0kRdi2yc4Zwzby6lNpfFhohYU5DoQOe IczKFMFe9MGAv6vizjOTUCgqsCgTYsETfuWNUH1rX0/YVrpSHqVJ3+phqbdWmXyi3BAR QZYkN2YeHf3AL3+6mBHPhMTjXyFPnlVK2eCXDmhC4bothw8/Sn/rDqkHYVxXh+OVweoC 6Q7h/ckVF7LdVRzh3Rp8ZuFiuXAt+EggkpOaG70C+rJ30gG7cirihkYOgN8vp6FnmvFh sXpQ== 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=Pvs4QKgjt42qnLRw2GurbkfXViAWQs5u2SUkVh4xhtc=; fh=O6aRB12iLfQPcoaBoN6ND3UiYcgSMHP3FYKR6EKS/0Q=; b=CIhpA3jLITOv02RLZsi+altXtZ4VbHrWI+ML7muu8kPFiGoLvCqg9jKV0Z12R9jR/j yoKMec3+Pe81MXdmRcSvywFLbFGtczw7bSQ+Bziywl1TPVn0bO8RV1ofCSWKBxpIhWto 8ZeFYf5vEuqGzBReljIItiGWxLjzmlz/hokRWCb4z+ablzRwgToo//4EFZjsYx+Gau07 v37dqjdIUmnM4DQ8gbaguqsoGlbflvesLZNbvvsa28VHs6ZSaq7kX4SSKaWN+hXQKMJL 9V5URKPur3y8CG3PBZpoUbv/zHte7EmnD8lx06Hvkg7PhZS9OGOsIL6GFYHIaU6BDetZ p2aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=TlSKxAPk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id by22-20020a056a02059600b00578a7f5a0afsi5055208pgb.357.2023.10.19.05.56.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 05:56:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=TlSKxAPk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 7042C82990C3; Thu, 19 Oct 2023 05:55:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345867AbjJSMy1 (ORCPT + 25 others); Thu, 19 Oct 2023 08:54:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345791AbjJSMwq (ORCPT ); Thu, 19 Oct 2023 08:52:46 -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 E7A79181; Thu, 19 Oct 2023 05:52:40 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:ccea:1fb5:34eb:239b]) (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 5B7276607356; Thu, 19 Oct 2023 13:52:39 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697719959; bh=hEdAN5aNNO1/pDSIenHgJGapeD5q9IeR/wL5fN5tnvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TlSKxAPko5PHW8AQZyZLF37lazQijX8qrL4wdv7yqcG7ETlAjebi5pc+JZbLY+e87 Qns5e3CLsUj02JYPqhjkXlDdq0LAy9uBYEZ+dVvuJHiNHeB3IhpuIwsaT+HsbeqrTs 4qNobax9zLgLJOLsCn/LJ0Nj1kPp4aDW7+jSfFjeBu+AM4+1d5/psD6lwGNqODZzfB 3Db2r5LZqrXo2SKJklOxwTFt+HWLQeyzo2pAHdq0wEgOrjKsmyyL7qFw4+dKBfpdYF T5BJoEGX16baEzZmQ+mSAI5a91osD/6o6JbG2bgwhBhYF7WTMlEJZ6iSr/2WK/A+aU 2qLRpoXkERITA== From: Benjamin Gaignard 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 , Hans de Goede , Sakari Ailus Subject: [PATCH v13 17/56] media: atomisp: Stop direct calls to queue num_buffers field Date: Thu, 19 Oct 2023 14:51:43 +0200 Message-Id: <20231019125222.21370-18-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231019125222.21370-1-benjamin.gaignard@collabora.com> References: <20231019125222.21370-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 19 Oct 2023 05:55:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780188675860363407 X-GMAIL-MSGID: 1780188675860363407 Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. This allows us to change how the number of buffers is computed in the future. Signed-off-by: Benjamin Gaignard Reviewed-by: Hans de Goede CC: Sakari Ailus --- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index a8a964b2f1a8..09c0091b920f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -1028,7 +1028,7 @@ static int atomisp_qbuf_wrapper(struct file *file, void *fh, struct v4l2_buffer struct atomisp_device *isp = video_get_drvdata(vdev); struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev); - if (buf->index >= vdev->queue->num_buffers) + if (buf->index >= vb2_get_num_buffers(vdev->queue)) return -EINVAL; if (buf->reserved2 & ATOMISP_BUFFER_HAS_PER_FRAME_SETTING) {