Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp332412rdb; Tue, 16 Jan 2024 01:22:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMYTRXC0o1DaSgYPGJj86/GszAqigAZGfinWMzpTSPs5McNGAs7+nYe38unHmLResnPHng X-Received: by 2002:a05:6402:2281:b0:559:3b49:4a14 with SMTP id cw1-20020a056402228100b005593b494a14mr3205507edb.9.1705396929034; Tue, 16 Jan 2024 01:22:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705396929; cv=none; d=google.com; s=arc-20160816; b=zD4qdJPx4x9oZhXFeqDrPnKJYVnCBJ6tVBLv4HJFX/se8e3s95OaTNTJhaalE+Dcul /nyyID+8HSs1nu3oea07JMHlzUCd2vSIlZ0p9Wpksx+Vsqau5Lqgup0hjBRo5W3aG6eD R6xwQ7PlLIGuSF8PHtkB79Z6U/zdSrV3tJORQucaUWGaiczU9WRiJauz8yrb6sxHbu/L 9Y78GExq46UHZxSq83HC1On99JDtsEhaRwE5pjjx/9DsNWk08+XgGFkjZpKUZHC1OYey 1zZeOUR09cNAe5XdC/i3FhneDYVTXwiHF1RgBskk2VXQB2iKKNds1nXeTZBPvy8vNfP9 smJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=+RFGxS7q0YAESDVb45weiJK9xzrGQw77b3V1dt13PsQ=; fh=s5ILSJYGrltTZ4252qGnp2owfPbQLBzfcEObv0h78nE=; b=flTf4EVeZ99TUs5Jq/CBzNBODB4CynD4bZIU1Hpp+kmcycKdH37pR1lve9PygL/Qle PYUQzShLbDQb7s1+sas2gm47xYPMFnsr2wb4l7eMYbl5iKKBUgngJhiqm4KYbogoTJ5C 6A4DM7D/4TJK0itpz4/3rCiX9CBRbCWtsmega3JTLlMdE6vKZ9PLU9Pzr8+MTvGw0JRn SNSRR4tpj2dgkl9FvTK7vWhX74YfSHdgIuue2VBJygoFNuA7XPXn/vJkpDUS7niDSRCk dmwLfoNNf/C4bltOE4I9a+Sedt1B5wn4RlMBwgKAqqlFV/BK8mBKLictiZQERYxhIbdD MqyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27165-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h11-20020a0564020e0b00b005582ed73bfcsi4793418edh.87.2024.01.16.01.22.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 01:22:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27165-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-27165-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C06681F240DF for ; Tue, 16 Jan 2024 09:22:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B60C212B82; Tue, 16 Jan 2024 09:21:57 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E287125B2; Tue, 16 Jan 2024 09:21:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F049C433C7; Tue, 16 Jan 2024 09:21:55 +0000 (UTC) Message-ID: Date: Tue, 16 Jan 2024 10:21:53 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] media: media videobuf2: Stop direct calls to queue num_buffers field Content-Language: en-US, nl To: Benjamin Gaignard , tfiga@chromium.org, m.szyprowski@samsung.com, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com References: <20240115170826.214519-1-benjamin.gaignard@collabora.com> <20240115170826.214519-2-benjamin.gaignard@collabora.com> From: Hans Verkuil In-Reply-To: <20240115170826.214519-2-benjamin.gaignard@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 15/01/2024 18:08, Benjamin Gaignard wrote: > 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. > > Fixes: c838530d230b ("media: media videobuf2: Be more flexible on the number of queue stored buffers") > Signed-off-by: Benjamin Gaignard > --- > drivers/media/common/videobuf2/videobuf2-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c > index 41a832dd1426..b6bf8f232f48 100644 > --- a/drivers/media/common/videobuf2/videobuf2-core.c > +++ b/drivers/media/common/videobuf2/videobuf2-core.c > @@ -989,7 +989,7 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, > bool no_previous_buffers = !q_num_bufs; > int ret = 0; > > - if (q->num_buffers == q->max_num_buffers) { > + if (q_num_bufs == q->max_num_buffers) { > dprintk(q, 1, "maximum number of buffers already allocated\n"); > return -ENOBUFS; > } There is another case in vb2_ioctl_create_bufs() where num_buffers is accessed directly. Can you fix that one as well? Regards, Hans