From nobody Mon Feb 9 12:01:37 2026 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (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 A72642BF3C5; Wed, 12 Nov 2025 14:37:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958247; cv=none; b=T/r81w68MLXofGmROnyIevKTp5TCOm8JTG9PdYX4+L/mZPBvcyvGiKxjOoTGkglI8gHa93fc8q4j3gxcAM2aVzctLtFX2RFOth0oGM7KSYwW1u3Mmtgq9994GY88nUvZ/ajTrfVxTx2soNvMe4YOUf861olSEE3ptKfppWDPFmY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958247; c=relaxed/simple; bh=2rN9cVOLQNBOCiMXSgtkSdhDPfGsitN4aJw2gBuh2bY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r88xCTMH1Ys/BomqSjV31dg51N+lo3aIzPDCy1bHDH+bD3XpiDELD7v7YYTxyictWQMCnRsSkyrlqXksGLP44yS2FBw6QG49AyB3C82E4RfD8Z8BaYrfoEV9LdWvRsoUcwebwMEsndqYDDTu4TNfGup3gk8n97nC2iVyo0Tlf/I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=VjOBoLyf; arc=none smtp.client-ip=91.218.175.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="VjOBoLyf" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762958241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ltyZ37LEJwhrSuuGnHe4IRgod3HGjI74kx98i9cMA80=; b=VjOBoLyfYylZG7PBMU03hQSIvcAZQVGfkc5kp0F3Sof37/OS4sFMu/hjb6+SLRxOcchROT FptiCz+YYndoCd+nL7SoPVpY+GeKqaT1nDEnKmREh/s6/9y1S4wcRpao6XLViWrqgR0Ptt lrw/Y2W4XTIAZ1BmYWRjb5VJh4JYMwY= From: Yuntao Wang To: Rob Herring , Saravana Kannan Cc: Geert Uytterhoeven , Catalin Marinas , AKASHI Takahiro , James Morse , Chen Zhou , Baoquan He , Zhen Lei , Andrew Morton , Changyuan Lyu , Alexander Graf , "Mike Rapoport (Microsoft)" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yuntao Wang Subject: [PATCH 01/10] of/fdt: Introduce dt_root_addr_size_cells() and dt_root_addr_size_bytes() Date: Wed, 12 Nov 2025 22:35:11 +0800 Message-ID: <20251112143520.233870-2-yuntao.wang@linux.dev> In-Reply-To: <20251112143520.233870-1-yuntao.wang@linux.dev> References: <20251112143520.233870-1-yuntao.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Currently, many places use the result of the expression `(dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32)` for various checks. To improve code maintainability and reduce the chance of errors, extract this expression into two helper functions. Signed-off-by: Yuntao Wang Reviewed-by: Geert Uytterhoeven --- include/linux/of_fdt.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h index b8d6c0c20876..9ce2433865ae 100644 --- a/include/linux/of_fdt.h +++ b/include/linux/of_fdt.h @@ -30,6 +30,17 @@ extern void *of_fdt_unflatten_tree(const unsigned long *= blob, /* TBD: Temporary export of fdt globals - remove when code fully merged */ extern int __initdata dt_root_addr_cells; extern int __initdata dt_root_size_cells; + +static inline int dt_root_addr_size_cells(void) +{ + return dt_root_addr_cells + dt_root_size_cells; +} + +static inline int dt_root_addr_size_bytes(void) +{ + return dt_root_addr_size_cells() * sizeof(__be32); +} + extern void *initial_boot_params; extern phys_addr_t initial_boot_params_pa; =20 --=20 2.51.0 From nobody Mon Feb 9 12:01:37 2026 Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (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 2059C2BF3C5 for ; Wed, 12 Nov 2025 14:37:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958255; cv=none; b=W83wdjLzVsVEbEBwSBacL5+Hk7cx8o8ZL5GApAzn2o/xcnatbGiJCNAPhQ4K54IUafBFmj8LP9rC2CpIY7jMszv4HQVKkGs/jWIr0Np+6+hyKnsg4OvAcCXiKzcNIIJDCrmkOI7PS6yjTkhgZ4o/E0YGUYDf6/2luxNZrgGap3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958255; c=relaxed/simple; bh=KUaz13UbB8OLq6l6G6TlNd70ET1Mwc3jEJ9+JWehkF4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JqMow8PUzrgNpPJoM8m8AFbRq6PiDSCTDKaY9xoBfhR6dX6mUGEOd3IQJEj1AnA4nvthPdmd5iAzwPAqMkT43GPo5G+eS2HWSNBgSv8OgvHSQAK8JNIXQETm+PZ2fuYlxSaYI/GfNQtaenE+4GVPLK4e6w6hY/zaI3K6n/06tug= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=q3AVVszw; arc=none smtp.client-ip=91.218.175.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="q3AVVszw" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762958249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yc0kfV4r2fjRhsZWr3QexNqNjpEEGyKvB/5qZrt2EqI=; b=q3AVVszw+CsNEAzTfDTqAqwC0WCG+jlFDQpeXJ2Iom2XfAflgrIhZLRl/DRCM8q4PPds8V rU18Fr0z/MqW7Z+vltFQtdzFO+hF8CR/MGIa9oA09+tCMcmS1NnOEmgd477v2C2WV6qpJ3 65a5MCWu2/Y2LJ6IraSzsPHrUxObojE= From: Yuntao Wang To: Rob Herring , Saravana Kannan Cc: Geert Uytterhoeven , Catalin Marinas , AKASHI Takahiro , James Morse , Chen Zhou , Baoquan He , Zhen Lei , Andrew Morton , Changyuan Lyu , Alexander Graf , "Mike Rapoport (Microsoft)" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yuntao Wang Subject: [PATCH 02/10] of/reserved_mem: Use dt_root_addr_size_bytes() instead of open-coding it Date: Wed, 12 Nov 2025 22:35:12 +0800 Message-ID: <20251112143520.233870-3-yuntao.wang@linux.dev> In-Reply-To: <20251112143520.233870-1-yuntao.wang@linux.dev> References: <20251112143520.233870-1-yuntao.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Use dt_root_addr_size_bytes() instead of open-coding it in __reserved_mem_reserve_reg() to improve code maintainability. Signed-off-by: Yuntao Wang Reviewed-by: Geert Uytterhoeven --- drivers/of/of_reserved_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 2e9ea751ed2d..67c0ccd373c2 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -154,7 +154,7 @@ static int __init early_init_dt_reserve_memory(phys_add= r_t base, static int __init __reserved_mem_reserve_reg(unsigned long node, const char *uname) { - int t_len =3D (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32); + int t_len =3D dt_root_addr_size_bytes(); phys_addr_t base, size; int len; const __be32 *prop; --=20 2.51.0 From nobody Mon Feb 9 12:01:37 2026 Received: from out-185.mta0.migadu.com (out-185.mta0.migadu.com [91.218.175.185]) (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 5C1C423F42D for ; Wed, 12 Nov 2025 14:37:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958263; cv=none; b=Bt6wjCLO6MHbvq7Ydf52E8UVUIEpZwmndv0KwrgKMo9TI6tx4Rf6kjiOTswhXM1TahHiwvcs3qYyotFr9ybN/EH31+K4oRYTSI028i9E2rUb5fRQIyBZtBI787sB+Z5BNQ18TpqeQLZ8dx5Y2m6zavOkDrhc4rMhk5RBeKbN9pI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958263; c=relaxed/simple; bh=FnJNwjc+en5RS+JbzwPkobo8ZAzHwK/8ia5Eorc3bFg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qT5Y9OkaXZPOqstqgox4KHENwhONu1+J1RBiAgwhodDnGHhD1ea7YZVamgJhGtvWQb6tr8xCR5MBDvpsWbxyQx9I3uX1EgNxFZ8fkXSsCdDEzOAoGj8RjTkvW4XqoZUvQn4ojdRycnZZJKg9rMTno1HSVVaZLToihWD2oxsQ2jE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=GwVtWhnu; arc=none smtp.client-ip=91.218.175.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="GwVtWhnu" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762958259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4cbw0txGZgveQRmvE3BdA/66SsL3EqAhAgd0O+UFaEE=; b=GwVtWhnuB1vnkuqa+YuRpjhRHNurmeP4s4SumezLBIyG7Iz5N72RhZbKM8EilMaRZo+Y+N CZGRXHZB80AfyoP2pjHcdm3jIWNw6Jjg0tUZlj3irvmPYvR0JW1ub6399ci5a9h7C4kSto fMVVmXPjSSrqJWLCiFxm4DqflU02ujA= From: Yuntao Wang To: Rob Herring , Saravana Kannan Cc: Geert Uytterhoeven , Catalin Marinas , AKASHI Takahiro , James Morse , Chen Zhou , Baoquan He , Zhen Lei , Andrew Morton , Changyuan Lyu , Alexander Graf , "Mike Rapoport (Microsoft)" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yuntao Wang Subject: [PATCH 03/10] of/reserved_mem: Use dt_root_addr_size_bytes() instead of open-coding it Date: Wed, 12 Nov 2025 22:35:13 +0800 Message-ID: <20251112143520.233870-4-yuntao.wang@linux.dev> In-Reply-To: <20251112143520.233870-1-yuntao.wang@linux.dev> References: <20251112143520.233870-1-yuntao.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Use dt_root_addr_size_bytes() instead of open-coding it in fdt_scan_reserved_mem_reg_nodes() to improve code maintainability. Signed-off-by: Yuntao Wang Reviewed-by: Geert Uytterhoeven --- drivers/of/of_reserved_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 67c0ccd373c2..0e6b0e7968a9 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -230,7 +230,7 @@ static void __init __rmem_check_for_overlap(void); */ void __init fdt_scan_reserved_mem_reg_nodes(void) { - int t_len =3D (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32); + int t_len =3D dt_root_addr_size_bytes(); const void *fdt =3D initial_boot_params; phys_addr_t base, size; const __be32 *prop; --=20 2.51.0 From nobody Mon Feb 9 12:01:37 2026 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (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 AB6622C08D0 for ; Wed, 12 Nov 2025 14:37:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958271; cv=none; b=U5fP/Lo8j2KlTPYvk7/YNL+o3S8bzxott7sVgzW96991uatXkLCsPRSUN9v53mxxBbfWnrUPw9zawkwBV5txP6tpKnUGe4VEc9m9G14c5ivgj5ImGis2dzllZXPSqHsfSozuOEmTxPLWFYth0U5L/4tpxqBTFT4Wyqt817nnB1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958271; c=relaxed/simple; bh=pSEDF0lQrns4O+mgGf/8pTKIHRG1thwFT/osmPdyD/w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ntyRxsrc4QLmgaGwcamb2ERNonx/DsF6gE0g/HKz3o6LC17Y99efgslyFjh5v5EITyRpfipdBqOz6ivvDJBRi5Fw2aEE5s9PvO+9mWs8rXigKrEjaSnoy7qai4EI/urDIpITZ0weH106eXJY15M/yB3DgL627/fBWP08n2yzLlE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=lKpuLYlA; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="lKpuLYlA" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762958267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=faXAXnUs+8NBBg9gIqemj+jSYNFlpSi8A6Cs8E7MSs8=; b=lKpuLYlAiR8M/tyg+m/wkgUplZyhrBFQvlpgQtSFRAxLz21H/UnXLlaDHLwWdXPMr/wOe2 SjSsdnWIk5yQZiirzmU1sQWDcSGdiZj6bbgopRJfe7hBlN2maeSgPgPsgXZKHxOD1lckCw Gh32Dlqjzx0PZGSMGabEE9WuUA+KAUk= From: Yuntao Wang To: Rob Herring , Saravana Kannan Cc: Geert Uytterhoeven , Catalin Marinas , AKASHI Takahiro , James Morse , Chen Zhou , Baoquan He , Zhen Lei , Andrew Morton , Changyuan Lyu , Alexander Graf , "Mike Rapoport (Microsoft)" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yuntao Wang Subject: [PATCH 04/10] of/reserved_mem: Use dt_root_addr_size_bytes() instead of open-coding it Date: Wed, 12 Nov 2025 22:35:14 +0800 Message-ID: <20251112143520.233870-5-yuntao.wang@linux.dev> In-Reply-To: <20251112143520.233870-1-yuntao.wang@linux.dev> References: <20251112143520.233870-1-yuntao.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Use dt_root_addr_size_bytes() instead of open-coding it in __reserved_mem_alloc_size() to improve code maintainability. Signed-off-by: Yuntao Wang Reviewed-by: Geert Uytterhoeven --- drivers/of/of_reserved_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 0e6b0e7968a9..8d9139f4297f 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -401,7 +401,7 @@ static int __init __reserved_mem_alloc_in_range(phys_ad= dr_t size, */ static int __init __reserved_mem_alloc_size(unsigned long node, const char= *uname) { - int t_len =3D (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32); + int t_len =3D dt_root_addr_size_bytes(); phys_addr_t start =3D 0, end =3D 0; phys_addr_t base =3D 0, align =3D 0, size; int len; --=20 2.51.0 From nobody Mon Feb 9 12:01:37 2026 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (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 D8A1930AAC1 for ; Wed, 12 Nov 2025 14:37:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958279; cv=none; b=BoE6jR+Y1QE74uadGr19EPWZOborfV405KTb2xe3liMIZ7/GRiGEtJyN92/ENfsyUlcxyAR4Ko3orKCMP6Ta0IMRf4SZ89ZsfLxrpWs/BDv50QQGO8QZRd2jOvlaC5YDtSwPVzH8NVlVFs8GFbrkTiNQsjOmpAogqCfQQjXaJb0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958279; c=relaxed/simple; bh=tlzXcMXy8FsmBGgDOagtaOXIuwvKvU9OQ00actPcIUg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S6jilgNc/l5JMIP+b2GR4dGw0jLcRLzSDlSDFYwOMXataai6qB1tguW2X7bCPgui7LMtnHWpIRzofgGPRDrrBdrLD3lPrdZw+aW+3pPPZqTez65kxJsE0JIJoYsW/0b6ky4jM99cPPrKWomcZ0RlFBew+0woFy7VUmxAKSTcMc0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Vrcw36mp; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Vrcw36mp" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762958276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UXYo/CzGAlYteilPh0ZKzeSdTBerfs4sNxjGWF5Bkm4=; b=Vrcw36mp4Tb0XqVNnMyiHjQYwMbtquKj0IIVKJssEjJbyBynju04/ez6VJE+GjQ2OUmi4t OnWx7084aU5S1Q66j38DdsLzDjbEmt1zcvJo7xMcisqQejt846lINewzj7I9cB3L+3O4ef ZTavnN8qQsUzGCpFVePpqCu2Rm37LKk= From: Yuntao Wang To: Rob Herring , Saravana Kannan Cc: Geert Uytterhoeven , Catalin Marinas , AKASHI Takahiro , James Morse , Chen Zhou , Baoquan He , Zhen Lei , Andrew Morton , Changyuan Lyu , Alexander Graf , "Mike Rapoport (Microsoft)" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yuntao Wang Subject: [PATCH 05/10] of/fdt: Use dt_root_addr_size_bytes() instead of open-coding it Date: Wed, 12 Nov 2025 22:35:15 +0800 Message-ID: <20251112143520.233870-6-yuntao.wang@linux.dev> In-Reply-To: <20251112143520.233870-1-yuntao.wang@linux.dev> References: <20251112143520.233870-1-yuntao.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Use dt_root_addr_size_bytes() instead of open-coding it in of_fdt_limit_memory() to improve code maintainability. Signed-off-by: Yuntao Wang Reviewed-by: Geert Uytterhoeven --- drivers/of/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 0edd639898a6..a1db3c9ac981 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -52,7 +52,7 @@ void __init of_fdt_limit_memory(int limit) int memory; int len; const void *val; - int cell_size =3D sizeof(uint32_t)*(dt_root_addr_cells + dt_root_size_cel= ls); + int cell_size =3D dt_root_addr_size_bytes(); =20 memory =3D fdt_path_offset(initial_boot_params, "/memory"); if (memory > 0) { --=20 2.51.0 From nobody Mon Feb 9 12:01:37 2026 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 65A75338582 for ; Wed, 12 Nov 2025 14:38:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958288; cv=none; b=djtrhHieJwrZPnWqr8po3kHTxkiyZR5D0VOsZ/iPSX2xMwgNCFHsQ46mMBD/C/36lHa52FyZA4g8pvqMbNtf8yP/k5uVsplvIQ0JFi0uQDYz7YZrQwf9u0BQTqrFGIJtL5IVutg8gNkNPSL+ZBDGAAV42P8HLayvr+c7X247aBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958288; c=relaxed/simple; bh=6gvFcInAP8t8L2kmK5h3Zxq2zu/wipQmo4Mnh+74jY8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Br+vzZRZmDWJXlzAH5HfqYdh0FnjP87ft+zeXvgGTWXIEQdt1f1fK44my9Hy+LNVgj0Aiy37xDa4dn4Td0I19Kc2u690MBbCtHAATmgp3DnnXB071ZXiIK4RLefa18djoTbTnOqjuW7yeSMPuXgGoyHu/0THtc03bxgbsBcSzcQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=vApOzEYw; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="vApOzEYw" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762958284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1NaEnFI/uQ27KEb/5xnqjBU/hb2tkFfiaNlWSyHEPWE=; b=vApOzEYw7bqknr3FxyFh1qQcLDcBVtF3FC9KYKp30/gByzo5lLnvADYMtbTZQbpIWLvPeD c2sPvwhyI0Z/6L/sNZV/lHmz7JNeXUiBykGvdHMdRwn+qxnhwZHntNnxPZRA4NKrcCq+qa nmVhposGyR9DdSAzVTVaOQbUyrZXSCU= From: Yuntao Wang To: Rob Herring , Saravana Kannan Cc: Geert Uytterhoeven , Catalin Marinas , AKASHI Takahiro , James Morse , Chen Zhou , Baoquan He , Zhen Lei , Andrew Morton , Changyuan Lyu , Alexander Graf , "Mike Rapoport (Microsoft)" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yuntao Wang Subject: [PATCH 06/10] of/fdt: Fix the len check in early_init_dt_check_for_elfcorehdr() Date: Wed, 12 Nov 2025 22:35:16 +0800 Message-ID: <20251112143520.233870-7-yuntao.wang@linux.dev> In-Reply-To: <20251112143520.233870-1-yuntao.wang@linux.dev> References: <20251112143520.233870-1-yuntao.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" The len value is in bytes, while `dt_root_addr_cells + dt_root_size_cells` is in cells (4 bytes per cell). Comparing them directly is incorrect. Convert units before comparison. Fixes: f7e7ce93aac1 ("of: fdt: Add generic support for handling elf core he= aders property") Fixes: e62aaeac426ab1dd ("arm64: kdump: provide /proc/vmcore file") Reviewed-by: Geert Uytterhoeven Signed-off-by: Yuntao Wang --- drivers/of/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index a1db3c9ac981..716ebe8c23d3 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -821,7 +821,7 @@ static void __init early_init_dt_check_for_elfcorehdr(u= nsigned long node) pr_debug("Looking for elfcorehdr property... "); =20 prop =3D of_get_flat_dt_prop(node, "linux,elfcorehdr", &len); - if (!prop || (len < (dt_root_addr_cells + dt_root_size_cells))) + if (!prop || len < dt_root_addr_size_bytes()) return; =20 elfcorehdr_addr =3D dt_mem_next_cell(dt_root_addr_cells, &prop); --=20 2.51.0 From nobody Mon Feb 9 12:01:37 2026 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (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 CC6B2338F23 for ; Wed, 12 Nov 2025 14:38:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958296; cv=none; b=i3lBcnb8GsuNbxV9hsmj1Y/OY86niy5PY97qFklc1aaHpW1eJhjbXMqIEX4aymt4bpPLtgj2Jw1tpXQiW10ExyqWnfvCxWrgvdS5eqVv8zEo/ZYXGoRa+8sDBX8zA80gcZWqGwQaye32j5Z3zUg/HD+YRZ3IKthaGu92ikIG/JY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958296; c=relaxed/simple; bh=SVrdZokn4Lg3YZClW7Ovq1EP/NlP9+GFaTssSuYuBNo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k+HQKSTumqqU68+nq+Di8HC4a9gWK/aVUFfDhZSczVhu5Ftn/ro/rRSoRtimE2QFko6GZ2XE8FNHUgGSLStlZeclKPFwYe35NJuCZexRsxiVWpfUEcWO1PYCaMmtBfX4dgIdzQZIGV4NwzweQEft1gNiyiV2GbFRMc/1X27EziY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=m/6pSkkz; arc=none smtp.client-ip=91.218.175.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="m/6pSkkz" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762958293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g+5LIko+l4oTBneHg9zMPQiGx1ZkBFSa9O+/fWSP2Kc=; b=m/6pSkkzPaGWn3w1k8m6Mx3J6tBEDh4LMCobyaYJQJGhNox3kBUUysBW/zgqsdWBc7vGgr c1cJQKUgFf+9ugfCcIl41hdQ6FX0hMeY088TGLhtNXnH2Q4whramE+hJxY1f0s9yERwK8J gEZtK5djniqHZxCBht/kGF8XMNjOwPo= From: Yuntao Wang To: Rob Herring , Saravana Kannan Cc: Geert Uytterhoeven , Catalin Marinas , AKASHI Takahiro , James Morse , Chen Zhou , Baoquan He , Zhen Lei , Andrew Morton , Changyuan Lyu , Alexander Graf , "Mike Rapoport (Microsoft)" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yuntao Wang Subject: [PATCH 07/10] of/fdt: Fix the len check in early_init_dt_check_for_usable_mem_range() Date: Wed, 12 Nov 2025 22:35:17 +0800 Message-ID: <20251112143520.233870-8-yuntao.wang@linux.dev> In-Reply-To: <20251112143520.233870-1-yuntao.wang@linux.dev> References: <20251112143520.233870-1-yuntao.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" The len value is in bytes, while `dt_root_addr_cells + dt_root_size_cells` is in cells (4 bytes per cell). The modulo calculation between them is incorrect, the units must be converted first. Fixes: fb319e77a0e7 ("of: fdt: Add memory for devices by DT property "linux= ,usable-memory-range"") Signed-off-by: Yuntao Wang Reviewed-by: Geert Uytterhoeven --- drivers/of/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 716ebe8c23d3..0f95f3b356ea 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -859,7 +859,7 @@ void __init early_init_dt_check_for_usable_mem_range(vo= id) pr_debug("Looking for usable-memory-range property... "); =20 prop =3D of_get_flat_dt_prop(node, "linux,usable-memory-range", &len); - if (!prop || (len % (dt_root_addr_cells + dt_root_size_cells))) + if (!prop || len % dt_root_addr_size_bytes()) return; =20 endp =3D prop + (len / sizeof(__be32)); --=20 2.51.0 From nobody Mon Feb 9 12:01:37 2026 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (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 38B012C0291 for ; Wed, 12 Nov 2025 14:38:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958305; cv=none; b=DBSUt0PSpX6BnHZd5etorPjbBSPZEw4pLg3JXJZZ0CKydpy3/6LstVyl4eeBgUiOmAk5WWFzpZ4+CWvf0+k9kfxrjzQk30sfec/bmppzaC94BqSIXBoEla4w8QfSt9hI6izhXxcyf7QNKAvNmvpQTNrTXsKGGlLb7Ghxy/aIm2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958305; c=relaxed/simple; bh=qAG7b6CrmwLKHaVCzWq/kvbmltnv3ETfDbOsvIfJXV0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pPf4XRZIg/N7ZT62FT75wwgdgxFJWRmIMAB7vxdCWbutr5ekmzZkj1pNLd0Oc8nWx0vXppzmO6MYF8ZGXBCqTmEde8VTARmioMDfYPZuPsZhDC92xJ/3TdMpoeAPEDVex+6Vzj0fe1eafXwilKAbHk2jTSru7+erGG6Q9wdVmd8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=B3pqmOmF; arc=none smtp.client-ip=91.218.175.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="B3pqmOmF" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762958301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mJ9CLcfN3/lUzD4QHZAccL9Pko4Inb0IrARgPU8hdt8=; b=B3pqmOmFPFILayUt4AKybr26jCvdalYWj2gBgloX9wmh54weLwrXjasorDANmyKFQVMCDu B71ULAC8TqPe42qs0f927ErIupLIiQmH+HXmWWDxMVly2Gt1hJ5ZRNt4BjOKVNFyiPtdJZ OVlidgggOL+Frp2YQvmyCjw+XVLeoXA= From: Yuntao Wang To: Rob Herring , Saravana Kannan Cc: Geert Uytterhoeven , Catalin Marinas , AKASHI Takahiro , James Morse , Chen Zhou , Baoquan He , Zhen Lei , Andrew Morton , Changyuan Lyu , Alexander Graf , "Mike Rapoport (Microsoft)" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yuntao Wang Subject: [PATCH 08/10] of/fdt: Use dt_root_addr_size_bytes() instead of open-coding it Date: Wed, 12 Nov 2025 22:35:18 +0800 Message-ID: <20251112143520.233870-9-yuntao.wang@linux.dev> In-Reply-To: <20251112143520.233870-1-yuntao.wang@linux.dev> References: <20251112143520.233870-1-yuntao.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Use dt_root_addr_size_bytes() instead of open-coding it in early_init_dt_check_kho() to improve code maintainability. Signed-off-by: Yuntao Wang Reviewed-by: Geert Uytterhoeven --- drivers/of/fdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 0f95f3b356ea..fa1703612530 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -890,14 +890,14 @@ static void __init early_init_dt_check_kho(void) return; =20 p =3D of_get_flat_dt_prop(node, "linux,kho-fdt", &l); - if (l !=3D (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32)) + if (l !=3D dt_root_addr_size_bytes()) return; =20 fdt_start =3D dt_mem_next_cell(dt_root_addr_cells, &p); fdt_size =3D dt_mem_next_cell(dt_root_addr_cells, &p); =20 p =3D of_get_flat_dt_prop(node, "linux,kho-scratch", &l); - if (l !=3D (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32)) + if (l !=3D dt_root_addr_size_bytes()) return; =20 scratch_start =3D dt_mem_next_cell(dt_root_addr_cells, &p); --=20 2.51.0 From nobody Mon Feb 9 12:01:37 2026 Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (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 69A362BEFF3 for ; Wed, 12 Nov 2025 14:38:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958313; cv=none; b=t4P54ajY/eGtH36SV4Rhyy8+hqUW6usB7yzN8MIpPBQSNYh7XTueJVM5gcF3kzNaXHXJgtqx6UIqT5f+RszZQugsxKdHhB6XObUVFdELJNOtie0v+lS9/nlCB87GEK4bpFaLwUvYoy1iceEx4oX7hvoozs3vl+2+TQGql6uFwVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958313; c=relaxed/simple; bh=iyoAsGQGFkkRyLWwIXuw9sz9AApsVOQKRvv9BqDR5LU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e2cNZVsfrBOCQcqB4FOx8SMSprMAxNWJSU2PXGJa21ddnZg1wyOhJSwUInoaCB+DMp86CPw++FnQSh+mOCS34mMFW8QlXYWgG4OLSCEsc/5V16m6JRAVVidlgrqwobTgObJt1ZbTPxOcQOxm1NVa9i1d7Ah+HLoB8LNJwP2agm0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=BOZsCKjj; arc=none smtp.client-ip=91.218.175.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="BOZsCKjj" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762958309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LzmGMWxJH7R4p+oRJophXFwsUFgFBj2qEtFwWWGetb0=; b=BOZsCKjjFQONm+8rxX6JqTQqwaXES9xxP7PKPpElFBb0Rz0lfQM8/ntbkCa2J9rzuLKG6T 72OuPWnrAWtfXpwJT4clt8e7Ood2QYwoOc9uy9Fzfo/izbnt1hkxkytyUw+Nao/kbGdJxE LL8pcnqPhwpFBdbOCmzsrckrerNTb2Q= From: Yuntao Wang To: Rob Herring , Saravana Kannan Cc: Geert Uytterhoeven , Catalin Marinas , AKASHI Takahiro , James Morse , Chen Zhou , Baoquan He , Zhen Lei , Andrew Morton , Changyuan Lyu , Alexander Graf , "Mike Rapoport (Microsoft)" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yuntao Wang Subject: [PATCH 09/10] of/fdt: Fix incorrect use of dt_root_addr_cells in early_init_dt_check_kho() Date: Wed, 12 Nov 2025 22:35:19 +0800 Message-ID: <20251112143520.233870-10-yuntao.wang@linux.dev> In-Reply-To: <20251112143520.233870-1-yuntao.wang@linux.dev> References: <20251112143520.233870-1-yuntao.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" When reading the fdt_size value, the argument passed to dt_mem_next_cell() is dt_root_addr_cells, but it should be dt_root_size_cells. The same issue occurs when reading the scratch_size value. Fix these issues. Fixes: 274cdcb1c004 ("arm64: add KHO support") Signed-off-by: Yuntao Wang Reviewed-by: Geert Uytterhoeven --- drivers/of/fdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index fa1703612530..3b34c7e71ebc 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -894,14 +894,14 @@ static void __init early_init_dt_check_kho(void) return; =20 fdt_start =3D dt_mem_next_cell(dt_root_addr_cells, &p); - fdt_size =3D dt_mem_next_cell(dt_root_addr_cells, &p); + fdt_size =3D dt_mem_next_cell(dt_root_size_cells, &p); =20 p =3D of_get_flat_dt_prop(node, "linux,kho-scratch", &l); if (l !=3D dt_root_addr_size_bytes()) return; =20 scratch_start =3D dt_mem_next_cell(dt_root_addr_cells, &p); - scratch_size =3D dt_mem_next_cell(dt_root_addr_cells, &p); + scratch_size =3D dt_mem_next_cell(dt_root_size_cells, &p); =20 kho_populate(fdt_start, fdt_size, scratch_start, scratch_size); } --=20 2.51.0 From nobody Mon Feb 9 12:01:37 2026 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 F345A2BEFF3 for ; Wed, 12 Nov 2025 14:38:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958322; cv=none; b=ekevOAr1EOIc8JSb9isym4U70N9XQQ4rd61x9UeiydfkesMTW1aCmjdgwZkrf5Yk3YCy8VeI3Tt9pY9EghHobfGJskBP05h05ZCV7VUr+/p/wLGFN3CrOBWh1HNFLJ84BaR+y78rBxYJLQPVz3F4vzMd4w6yk4jXnnYRejaOTxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762958322; c=relaxed/simple; bh=9J+GQsabqWq0SzdkzjfkY0+YAySvu0mHZIJKBIsN2SA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DZgH+v3p4T57neO/oN6K6IEiXa9ira4xA19/EdYoBwwv90pGXe5R+hJG55TPlWTYVL5MfsI4EP8KpQe4brQNPToaC7iG+HP0aTUxXnGoAeETbfD1nOFuc89mUN5Ih+sZuP6h+hRoKurBlGRFqEIbRXVvnK1zhd7PQ/yHvz/XDCA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=HuZVYKhw; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="HuZVYKhw" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1762958319; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RPVVr6R6/R4uLeTWW79sJbo88M16VGLNR2YUAhLQNnQ=; b=HuZVYKhwVa7mIpp7GLEabQYO7zytLZA0fV/X4oxkz/gBcin8w1+09UYcqYPKQFyI2GqHOo 83Sgf/x36JxHZarvwVTHG6WNy7tSQiFUsCeUXrtzTxev656j01RD/OY6EuYtE33g1s88UN 9af3ZSK1WFqhJstRFB7D1UhPLpCM9as= From: Yuntao Wang To: Rob Herring , Saravana Kannan Cc: Geert Uytterhoeven , Catalin Marinas , AKASHI Takahiro , James Morse , Chen Zhou , Baoquan He , Zhen Lei , Andrew Morton , Changyuan Lyu , Alexander Graf , "Mike Rapoport (Microsoft)" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yuntao Wang Subject: [PATCH 10/10] of/address: Remove the incorrect and misleading comment Date: Wed, 12 Nov 2025 22:35:20 +0800 Message-ID: <20251112143520.233870-11-yuntao.wang@linux.dev> In-Reply-To: <20251112143520.233870-1-yuntao.wang@linux.dev> References: <20251112143520.233870-1-yuntao.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" The of_bus_default_match() function appears to have been copied from of_bus_default_flags_match() with some modifications. However, the comment was left unchanged and still describes the behavior of of_bus_default_flags_match(), it is incorrect and misleading, remove it. Signed-off-by: Yuntao Wang Reviewed-by: Geert Uytterhoeven --- drivers/of/address.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/of/address.c b/drivers/of/address.c index f0f8f0dd191c..4034d798c55a 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -328,10 +328,6 @@ static int of_bus_default_flags_match(struct device_no= de *np) =20 static int of_bus_default_match(struct device_node *np) { - /* - * Check for presence first since of_bus_n_addr_cells() will warn when - * walking parent nodes. - */ return of_property_present(np, "#address-cells"); } =20 --=20 2.51.0