From patchwork Thu Oct 12 11:46:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 151983 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1166377vqb; Thu, 12 Oct 2023 04:50:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEquG2NvRuMY6ezkrK4Zt1SjGsvpvGmm30GSTxx++cNDsyKgLL6jVKTji69b7iVm2fgf7It X-Received: by 2002:a05:6a20:8f02:b0:15c:b7bb:2bd9 with SMTP id b2-20020a056a208f0200b0015cb7bb2bd9mr28336595pzk.6.1697111455553; Thu, 12 Oct 2023 04:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697111455; cv=none; d=google.com; s=arc-20160816; b=wGhzWEsJghLFovyWAmUw19j9XjeJ6IwuIRmSJOx/ie3J4P/ZbaLqxNCG1ehP+SRx9g l0Yl9YZLkQ98+9cs0zDFLnbWYB6e1eW6cP2Lqh2AjwKbvZ+K8u4GuTP6LjnFccQ+GsF0 e3cRAJa9Yh7y+ED9mtUMLP1WdNo3GOGoJT7DD8Ebfy8Q4zIprEeOvqW840xQdr4QGIqc ljzTVRnmpX8d+ZcxG3LnBNMQKy0XtIK+Ly6qNo4m1s1v/Yd7gtmixATabqfuf74ei8eL WAvTLfHSWBKErimTn2RJcLqX4Ob2DJEF4wRzOoBcbgzY8W74kZ4W8Wm5TgNRimV855aZ IvJg== 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=qPEIuGvMUx0Y6lpP2jaVnp425U8/1WBusmlHrwPIhKQ=; fh=O6aRB12iLfQPcoaBoN6ND3UiYcgSMHP3FYKR6EKS/0Q=; b=QF5jTTlXKBWVwJ1LwoEJNyBcJMCLk1Hc1ZjNZAOHBa+Gvio6IvcCDuN7KW4RML6Zqn 5fpzI1tqOJHsQmIALSaQKdBIyHxrrv7IN/v7aT1mKd8pRmA4xIS8/nNuGY0uxZi4nWVf dPrDYqx6VkxabvB9QCvcHURCAZz5cj3AwY0gllqooCQWuaTgZ/nnBKxKFgANcPMscXeO BEjhFajruH6SC0O5JAkzfVfm7BV33K2eiu5D5G7ydtQqwCezcTx1/5UIu/4H9Hdh45qc 5t4cDf22A2VTHQLdCuSAa6wlymqNldo3iUEXuW0eQ8KhXQGw+w9xje0qH6hb64Ax2kxH AFjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Zxz4EYtV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id n6-20020a170903110600b001c1eed8a336si2265650plh.167.2023.10.12.04.50.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 04:50:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Zxz4EYtV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 625EE81A8A8D; Thu, 12 Oct 2023 04:50:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378398AbjJLLsd (ORCPT + 19 others); Thu, 12 Oct 2023 07:48:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378449AbjJLLrA (ORCPT ); Thu, 12 Oct 2023 07:47:00 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C777DC; Thu, 12 Oct 2023 04:46:59 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:7ae7:b86d:c19a:877e]) (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 C79EB6607367; Thu, 12 Oct 2023 12:46:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697111218; bh=7OL5E3CW8F8eZCTu2km16+HY1SvtZLOVfrgm1/VXjy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zxz4EYtVb8eZSFa5Uwvd882wFWuAYhX2LKeQKSPTPbU4mWMEoKiEiWXHDiyBIQMyD vuvvnvWLu5IpQp8AwlFYRHQ+Wi6muvQsoSy5Jih1Y9pAWsC7Hvlk3ORXDoYxmwfkKi gcqO73cFAkkQwww8Uvr66ULYAuxbLJ7x1IimWRPkFx8vRQmX48eESO8YdIEtqNxJRO 2JOIN3GCYW8iRYzERUCZgC7JJhndFqoWai8IbOsvIK9wI3urIN5xxNd8L+59a88/zl MqvlbV2vdVD8dfpeZrBIDN2AuOqdktfMIjd3wBXfocEyJEjAiraiZytR6p3glVau8q cv7/ZPt5Lp1CQ== 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 v11 16/56] media: atomisp: Use vb2_get_buffer() instead of directly access to buffers array Date: Thu, 12 Oct 2023 13:46:02 +0200 Message-Id: <20231012114642.19040-17-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012114642.19040-1-benjamin.gaignard@collabora.com> References: <20231012114642.19040-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 pete.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 (pete.vger.email [0.0.0.0]); Thu, 12 Oct 2023 04:50:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779550341412062432 X-GMAIL-MSGID: 1779550341412062432 Use vb2_get_buffer() instead of directly access to vb2_buffer buffer array. This could allow to change the type bufs[] field of vb2_buffer structure if needed. No need to check the result of vb2_get_buffer, vb2_ioctl_dqbuf() already checked that it is valid. Signed-off-by: Benjamin Gaignard CC: Hans de Goede CC: Mauro Carvalho Chehab CC: Sakari Ailus Reviewed-by: Hans de Goede --- 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];