From mboxrd@z Thu Jan 1 00:00:00 1970 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 9A39B1DF99A; Fri, 4 Oct 2024 18:30:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728066640; cv=none; b=iAemoO5mp4GOLUrKznXj13yl4I9sKT/huulzIqqr40A5q3BvnjB5lt8JCcHlQ7aZaKNBiT9ZR7hn38nFKBvUKwGMCKwrlDMD+d5C1N/p6P63LoAxTABqqnepKi2/MMPlE2VwUqvUuMcrkdU+HT01f1FWDaC1NSyi0BYzw/lwVjA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728066640; c=relaxed/simple; bh=HFhL5BDeKrOgZOkOiyCFwrVuMYPrYx1tVgcD+hDd9p4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tRUEdxwIKZu6yEXgSnHO0K5+L2alKC5kgULtYqaPOS/luJtUHhX6tHseJBlKp8U7gDL8YGSUVOxDes1Fj2xEWkLad5dpNn5fWQVdQquLH4x83gm8xaSUZkHzDjpjtxgi0YZySoa3iF4eM1Z4eyENOOGbva30kAFQ7PWwx3AHhJg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z8xXGaoz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z8xXGaoz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7D55C4CED1; Fri, 4 Oct 2024 18:30:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728066639; bh=HFhL5BDeKrOgZOkOiyCFwrVuMYPrYx1tVgcD+hDd9p4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z8xXGaozoTGD2M6aO2Bwb/ghcA262gGUivQkpfDlg/VKTzsUEHnvY6qvDVc307E8U uqiBc6x5mtxLwm0I+A9Ouj53LjAAGex7IaMG10DrlcWdpP/X/1RiwvVyPE4bVW9DFv TI41HBL4PSz3IGHm7il2K19xY6b5emV/V6qr4cje99gtuajCH2bYRCELJ1eRrBIAhr E5qalJARCbiEPP4NxhMhnIIPsn5w73WScpVq9ud2x1+WFKt3wTrkgu1Cz13ydtu16f Esu3AjWd8vIj+D0H1fSIEBiK9EchkUol+WkDMmWC1zS/Q37SFx+vxnBF+pQmTrGFSY iwhJ/M8oF1n6g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yunke Cao , Tomasz Figa , Hans Verkuil , Sasha Levin , m.szyprowski@samsung.com, mchehab@kernel.org, linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 18/26] media: videobuf2-core: clear memory related fields in __vb2_plane_dmabuf_put() Date: Fri, 4 Oct 2024 14:29:44 -0400 Message-ID: <20241004183005.3675332-18-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241004183005.3675332-1-sashal@kernel.org> References: <20241004183005.3675332-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.10.226 Content-Transfer-Encoding: 8bit From: Yunke Cao [ Upstream commit 6a9c97ab6b7e85697e0b74e86062192a5ffffd99 ] Clear vb2_plane's memory related fields in __vb2_plane_dmabuf_put(), including bytesused, length, fd and data_offset. Remove the duplicated code in __prepare_dmabuf(). Signed-off-by: Yunke Cao Acked-by: Tomasz Figa Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/common/videobuf2/videobuf2-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c index 3bafde87a1257..78ad2b278da4c 100644 --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c @@ -301,6 +301,10 @@ static void __vb2_plane_dmabuf_put(struct vb2_buffer *vb, struct vb2_plane *p) p->mem_priv = NULL; p->dbuf = NULL; p->dbuf_mapped = 0; + p->bytesused = 0; + p->length = 0; + p->m.fd = 0; + p->data_offset = 0; } /* @@ -1278,10 +1282,6 @@ static int __prepare_dmabuf(struct vb2_buffer *vb) /* Release previously acquired memory if present */ __vb2_plane_dmabuf_put(vb, &vb->planes[plane]); - vb->planes[plane].bytesused = 0; - vb->planes[plane].length = 0; - vb->planes[plane].m.fd = 0; - vb->planes[plane].data_offset = 0; /* Acquire each plane's memory */ mem_priv = call_ptr_memop(vb, attach_dmabuf, -- 2.43.0