From patchwork Thu Nov 9 16:34:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 163475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp558479vqs; Thu, 9 Nov 2023 08:38:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGoNCtYhqiEc8chSbqdN0jKUXXuxZdbfgp2lo8xh9fWZSoAq9VcQZvqj8fxDSS205RnG/7C X-Received: by 2002:a05:6a20:3955:b0:15c:b7ba:6a4d with SMTP id r21-20020a056a20395500b0015cb7ba6a4dmr6869493pzg.50.1699547887179; Thu, 09 Nov 2023 08:38:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699547887; cv=none; d=google.com; s=arc-20160816; b=R4KHVfNPsPmtnXjkI9HcXkJ3OYBG7W3K34QT1ZrniiJWeYjk6DuCvZoangvCEu21z2 79j4AVTGn2Z3cCNttnPdydToGHISO5FZD/P1ueMIoeu08eqmEBaxAjE2aUj22QVkFm10 PUDeDPEu0EhNhG1HK58UWQFvN2MoqX6vGJW0r+DAqXLlHM1mwyh2sMd51Bu24m2MNSvr gswCNbyPrVyR+zHRssj7mivv1mPLtTVkoWj2zf1fclyV5O2WzRDXr3iiUBXdesrcJzd4 TY4ErtkWRlHV7VPeKQ42Vg72ccvOBPw8QZV4GIZxKCpjoieekGOxrfDHSqAvfDCMtu4w EspQ== 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=f49aorVPdY3Qh6gQ+W9AUYEv3A9Ok0jRAKXFSnangI7dBKgd1G7FUOw2qtmQSqwHmK weuAXlal7o/iTHyFiXblO2iMaO4qb+OxQj0f51JHb95pbK0PJ7bsj9q+ewD8qvhPyntd rjh5sWgqz6vQ1ElkLJn8n5/O5QAduFNHOveHKn1KodCDkR0n5LyjaWa1LyDpsd3zvzSq kWKsR5cQ4kWnDn/bsUKSxk9be2MeL0V40XffOu0K0Zk9poiIZ2RDUhZ0HFfHailJ6GKO J7nkFUH5mi5XwNe+3MWosN1ZGZqrydaZQ5Tw+lKxf6AaSVk9kznCKHjKsCSy1zCHlxTZ 74Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=kZVXuIiw; 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 c14-20020a056a00248e00b006c339527ab8si16299370pfv.192.2023.11.09.08.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 08:38:07 -0800 (PST) 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=kZVXuIiw; 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 D3158836E5FB; Thu, 9 Nov 2023 08:38:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344255AbjKIQhu (ORCPT + 31 others); Thu, 9 Nov 2023 11:37:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234627AbjKIQhq (ORCPT ); Thu, 9 Nov 2023 11:37:46 -0500 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 1FB6B3843; Thu, 9 Nov 2023 08:37:44 -0800 (PST) Received: from benjamin-XPS-13-9310.. (cola.collaboradmins.com [195.201.22.229]) (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 F25B8660741B; Thu, 9 Nov 2023 16:37:41 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1699547863; bh=NE9Dr0xaEnB6dw9lflcnBD1PZMhluEk9SDENx9Slyak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kZVXuIiw4SFUXVgXuIO063mfiC0LD7+zHWWLu8i1PG7XTKs3Y4D0rmVUKLu+1WzYc t9BVrPUIBS6hfqZPJ1+qFi7PE0JqZ4JSg8JmLA7leGTgF5zd57dtfmD2A5Cr/0CO8d uExpmgAXjikLHNXbbKM0PlyKBwDjYIj7HPJMyG+jMDVPokI30QfcjqeNGhUmfT9cTW 6f2tPxNGh0NHrMjdjo/pPPGd0CLRzG4Mi4/s9bWs8bbAAry6A9cz64vFa46jBSxWtb GYlA54wq4Cvwmoy1VjsUbOYpWPgOTnLUe6WjAQhkt2oKo6x1QaOWDnClgnsG2e4nDY rhEQ9i23ZmH2A== 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 v15 16/56] media: atomisp: Use vb2_get_buffer() instead of directly access to buffers array Date: Thu, 9 Nov 2023 17:34:32 +0100 Message-Id: <20231109163512.179524-17-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231109163512.179524-14-benjamin.gaignard@collabora.com> References: <20231109163512.179524-14-benjamin.gaignard@collabora.com> MIME-Version: 1.0 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 (snail.vger.email [0.0.0.0]); Thu, 09 Nov 2023 08:38:05 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782105125637162253 X-GMAIL-MSGID: 1782105125637162253 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];