From patchwork Thu Oct 19 12:51:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 155518 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp359822vqb; Thu, 19 Oct 2023 05:55:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLitFF90WAHF4jUpslCmao5u8gC/nv2GJ8/QKhNowWQ5GcGhdDIBwhP4dzib3WkliOXlrH X-Received: by 2002:a17:90b:4c:b0:27c:fbfa:e2d with SMTP id d12-20020a17090b004c00b0027cfbfa0e2dmr1937791pjt.45.1697720107933; Thu, 19 Oct 2023 05:55:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697720107; cv=none; d=google.com; s=arc-20160816; b=PSKtfqruGAJ1NmJBAaGjX7Uca1BGoWdxUH0oLxenWGlsF9NCxpe6rkYJE+wipigQHW 39i2tl20oA3dMoYOxo8r5ShGkgR2Mrdfr4zBN9bYQcv9LGXqJQl+RR62Jr5cvHkUasD+ Zw3g0NcdrAdG4iARzRr4LVD2GmyWNlsTj9l2CuHtExcM/adUTpyFOqVhPy+zJv06vNcr nPQBZRdCXlxhpYXUjj6i+/MIIVwBqErTum6wyLRfx7SYm0xhlGQABBgJX8Zb8olynRp2 w9WfJZLwkjILSNdzaKJoiZSStR66LBV0aQ/Avw20uhlvDZUaaTFlS4HgH4b4eNZwkxwa ISRw== 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=VM4NzMJMGv79npf1U7MuzJpl4mPtUAdgVx8a3O8ahTM=; fh=O6aRB12iLfQPcoaBoN6ND3UiYcgSMHP3FYKR6EKS/0Q=; b=cXjlH75/84ucuvnaDNGzpuCNAGuybFpowkKz8CmPfMHs2jfekjnHnMPIGuMtyf3Odl xMqFS4CEj3Oh8X/Msxfh0wi0+YT1gusn/4FXaoB7Issq2Oq6F3UanQYMqgBtYz7A/PHM sMnUpz9bsDwJBiRtLitI63idlEGWakuqrbKC+Gt3GhHLiYC/CyN7d3/gpG2yncDmqV0o GQB517+xDOJMt71l8FvC115ZLz+HJccTYYR4m40vJwOCQC7fq4QhqjfyM4tr/iJyvsG7 nzmJE60bE3MZCIz3ZOJbBG0FlVF+1MvQkGer+NxA9K5E6QMc9/CfQBustMbq59bTtqV8 8dpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=MMIH1oaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id mg11-20020a17090b370b00b00277453e82fesi2005656pjb.87.2023.10.19.05.55.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 05:55:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=MMIH1oaz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 8F3A0827D66E; Thu, 19 Oct 2023 05:54:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346013AbjJSMxy (ORCPT + 25 others); Thu, 19 Oct 2023 08:53:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345789AbjJSMwq (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 6A0C213D; 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 CA2E66607355; Thu, 19 Oct 2023 13:52:38 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697719959; bh=NE9Dr0xaEnB6dw9lflcnBD1PZMhluEk9SDENx9Slyak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MMIH1oazqYayxx+w2kPp81TINqbJbDetnZ4OYCkCDUGogjR6PlJZf1V1z3rtPGmHp UIBHtxgjXelaAs7zg8kKzE2L/VmIRMe8AmfQHRQsnGiLYvRnPJWP2gGkYgEGbMP7QJ UYcblL6E57NhMPQyTKtSLqPXEXxnpAwvlMNRNJuI8jHiPBZq6H2tvVmDZt2L0tU73s 3cJPQyVqsqJ2BFe784EfEiMrqeb1s4JEfiKsSraB0Wo/e7/rOoX9SItokDdQ/yLfwR 18ANMkw+f+HfUb+4eJQ+/+PivwNFXzhbbeH4AMZjuLQ3T8kS4CmXov5QgfKsM43E65 S5qfCSXlN817w== 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 16/56] media: atomisp: Use vb2_get_buffer() instead of directly access to buffers array Date: Thu, 19 Oct 2023 14:51:42 +0200 Message-Id: <20231019125222.21370-17-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 howler.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 (howler.vger.email [0.0.0.0]); Thu, 19 Oct 2023 05:54:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780188559687689284 X-GMAIL-MSGID: 1780188559687689284 Use vb2_get_buffer() instead of direct access to the vb2_queue bufs array. This allows us to change the type of the bufs in the future. No need to check the result of vb2_get_buffer, vb2_ioctl_dqbuf() already checked that it is valid. Signed-off-by: Benjamin Gaignard Reviewed-by: Hans de Goede CC: Mauro Carvalho Chehab 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 a8e4779d007f..a8a964b2f1a8 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -1059,7 +1059,7 @@ static int atomisp_dqbuf_wrapper(struct file *file, void *fh, struct v4l2_buffer if (ret) return ret; - vb = pipe->vb_queue.bufs[buf->index]; + vb = vb2_get_buffer(&pipe->vb_queue, buf->index); frame = vb_to_frame(vb); buf->reserved = asd->frame_status[buf->index];