From nobody Thu Dec 18 00:09:50 2025 Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 E37AF38F9C for ; Fri, 6 Dec 2024 00:53:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446392; cv=none; b=lijq6b9Ibj85g7nMw6jWkGcKDUDcw0bp7T9uWzbP23dbsEFpc/u3BGjpI8nPC7jkJkYApaQwGkxOrcV9LJOwTFsEm5kJ7xm60dKoXndn6bCD5ZpXpfpVU8ibMPhvsLCQM/cCrTROM6WYg9syh6oyiquM0eJ2lOS1upwNbtfFLG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446392; c=relaxed/simple; bh=Wwz17/zhfYFbbFxy81RaIgqyHTpcJu8VU0c4FjQZIqk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Pwe0mdLZeYSU9PfLzvzy0g24JzI7ha4ZhwbsWGxQScWG/3hiQykySEc7K01gZtvRBATmHkDfZ06PLpiWFVT3nyrEWSykw0ovFjyU+PLkzSwh/lqqJuSswMQjhmfmHaqS97/DKhQF57gjSnwdS20LADZ7xvy19Q01dE0APGuI364= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=eLeNS1rW; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="eLeNS1rW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446390; bh=Z8FxYowJt8L03PaNytmuPjkcdXVFkhckag7aRnXxAiM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=eLeNS1rW03NcojFnd0UQ7um3nBqmjQXtLh6FEjC31VkcTdYLrqSUpCwJiuhYO5GVW QWHX2XiGfKdt668M93bqV4J8xJCV+WebgvLVvvxXtyqgNTUfaxc6KnQFkEnzdDO7u1 r4+C6D0fz7+zSc5shNvuyxLF76Jb4Vh6OE4rtHFfqBU/Lb81KAqEdbGDQFxu4BDMXH sGE6GQV6yRzmcy+pT8UbSn36TLqqQ5VKkeDatUfriOEPBaOg0bERuAY8LEG8PL5zLe pWpi3OtKf22Ww5Z3ZuesLuFGBMw9qk37Y9TEQb8rVjz/MI5TY1kRjce4mGFnHuD0S0 3FNwBFnVXnv+A== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 42E30A02C3; Fri, 6 Dec 2024 00:53:03 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:27 +0800 Subject: [PATCH 01/10] of: Fix alias name length calculating error in API of_find_node_opts_by_path() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241206-of_core_fix-v1-1-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu , stable@vger.kernel.org X-Mailer: b4 0.14.2 X-Proofpoint-GUID: JLWXoN9J3ROI2oJSfcVDAoO7hFSlu5j_ X-Proofpoint-ORIG-GUID: JLWXoN9J3ROI2oJSfcVDAoO7hFSlu5j_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=878 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu Alias name length calculated by of_find_node_opts_by_path() is wrong as explained below: Take "alias/serial@llc500:115200n8" as its @patch argument for an example ^ ^ ^ 0 5 19 The right length of alias 'alias' is 5, but the API results in 19 which is obvious wrong. The wrong length will cause finding device node failure for such paths. Fix by using index of either '/' or ':' as the length who comes earlier. Fixes: 106937e8ccdc ("of: fix handling of '/' in options for of_find_node_b= y_path()") Cc: stable@vger.kernel.org Signed-off-by: Zijun Hu --- drivers/of/base.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 7dc394255a0a14cd1aed02ec79c2f787a222b44c..9a9313183d1f1b61918fe7e6fa8= 0c2726b099a1c 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -893,10 +893,10 @@ struct device_node *of_find_node_opts_by_path(const c= har *path, const char **opt /* The path could begin with an alias */ if (*path !=3D '/') { int len; - const char *p =3D separator; + const char *p =3D strchrnul(path, '/'); =20 - if (!p) - p =3D strchrnul(path, '/'); + if (separator && separator < p) + p =3D separator; len =3D p - path; =20 /* of_aliases must not be NULL */ --=20 2.34.1 From nobody Thu Dec 18 00:09:50 2025 Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 1546A38F9C for ; Fri, 6 Dec 2024 00:53:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446399; cv=none; b=lxyCNoihjti+U5dLHIPRgFRioKfO6J/+RXyBM31eWYLg2QzXgxmwjvrw02q/afDIFSjvZ0wJ6jlgsGF4hv3+H4Cra73ZeTM1bqIwWSFHBwODjlUDKATBEAuZICASIeMwsBxWpprtI+sV8pgkfEms8rsD7rDnZA3VS+avAjiKKvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446399; c=relaxed/simple; bh=QNsEWPAUkVVpVRHkibyslz6e/t3LkzhnTAjUDcHXryo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T2LiG0S2fTwQGBfauSB1hCeDYM8IcPWxa8k7aZLjh87sYErua+BOShcmlxd5y9SH6H0fwiMExeOYobzwl8zHxp4I4C6YzbJEC/ShsF1DmSqrMBtnLIa2LTZVjzsGc3xR0hJq777UIKm7hqQ4Q9HR2heBhAVtnVqE8IHRJogE1EA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=vS/rPvlR; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="vS/rPvlR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446397; bh=RWEwv6+w7N1voYBxavX8EFSb/Sf8/2DrEXYvWY7v5b8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=vS/rPvlRMVJdI3sTb6UxqxuUmZkywhQliTgtCNwf9IkCPmEeE+MYVn1rRYh7Ryc87 VQSbhHXg14duSX/X8ey6dc51Vd+D2+wj1MWZ3wP7iRGBmyM5J7pwAws6/oZP/iX33Y JkAK4Xwv/H15KmCaM2M+31s0BQ+gf5vz8QWb0GqNGQX9ODlgKCz2fWvhfJSJKmxLJb 5/JrmlL4dhCJd0fIT0W/W+lKgHFa7NFgnNN1ZOyxSJZYtfi+fqyzEwueINiy+WJeQk XMZ2/lKhArILdPHpRfnH+3x3xOQlzN73CuVkzCuqPicKJNLmrXI6sVv3wb0eUdKNwX 0lz+iI2BBA6Gw== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 4E134A02CB; Fri, 6 Dec 2024 00:53:10 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:28 +0800 Subject: [PATCH 02/10] of: Correct return value for API of_parse_phandle_with_args_map() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241206-of_core_fix-v1-2-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu , stable@vger.kernel.org X-Mailer: b4 0.14.2 X-Proofpoint-GUID: CmPjX01vzh582m55VjBZWZ-kMxVZ6PMg X-Proofpoint-ORIG-GUID: CmPjX01vzh582m55VjBZWZ-kMxVZ6PMg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu @ret is used by of_parse_phandle_with_args_map() to record return value and it is preseted with -EINVAL before the outer while loop, but it is changed to 0 by below successful operation within the inner loop: of_property_read_u32(new, cells_name, &new_size) So cause 0(success) is returned for all failures which happen after the operation, that is obviously wrong. Fix by restoring @ret with preseted -EINVAL after the operation. Fixes: bd6f2fd5a1d5 ("of: Support parsing phandle argument lists through a = nexus node") Cc: stable@vger.kernel.org Signed-off-by: Zijun Hu --- drivers/of/base.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 9a9313183d1f1b61918fe7e6fa80c2726b099a1c..b294924aa31cfed1ec06983f420= a445f7fae7394 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1516,6 +1516,8 @@ int of_parse_phandle_with_args_map(const struct devic= e_node *np, ret =3D of_property_read_u32(new, cells_name, &new_size); if (ret) goto put; + /* Restore preseted error code */ + ret =3D -EINVAL; =20 /* Check for malformed properties */ if (WARN_ON(new_size > MAX_PHANDLE_ARGS)) --=20 2.34.1 From nobody Thu Dec 18 00:09:50 2025 Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 EC7C480054 for ; Fri, 6 Dec 2024 00:53:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446406; cv=none; b=X8F1JdPm/wnrbO6CJlYI5KOpOiFawkEy996x8VHaUYO/DFrheUJzzHY69UWIwWL0nYAmavLC3r3jmMJ1ktpcKTuT/1UkEyO17GrySGGpB5XUN3xGRAS1cs4t92V2UCYWWjmdPn4KiCsDPq8YKPwe5Tc7ACuNs02YLemkRaQ21b0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446406; c=relaxed/simple; bh=mEThiGvzQrWP4T5PTbX9axo1KDuPsGVUxJFR2EnyR6Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LEoTtCQbcpVMXuW3Pj8kzpDYoACltBU/co2CTfKcszbSSk+GbPbdDtUgvDDJbKt1t+fCr6O5r7X+bWdzQWzGlvPlM6r2y1TMJVRSuFdEC8LJncqTxdCBZJyiKLt/vTIArOkXdHkwmA+wZxJWxWW/vIGkXqsZO522jn0E6ygYhUY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=lDypAx2r; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="lDypAx2r" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446404; bh=dz50I+uPmRhfwhn2tfWCnV8FssyJCtBV9kiQ8UvvO0A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=lDypAx2rdyIN/ZFc9shpxJ5OI/QQ6e6nPRppyfB07woqWrd+yINxO3zyYJHHsNcw8 a5Mf6NYje7GCq6GlgxLIBGXPnW0dZK8wY0tfOwW3+NolMkVX2wYn9aADI+T+scIbCu xlK8wJJflC0rqmfhNMCBH/fnLEyzt/HI1vIjcKgtrW+YMIshKl7jRB8zY23BLJCase 8kQVtHceyT7atS9RPeVASQRAUq2zIq8ETAOsbjAprA9lCAJeM196paOKxRhQarNkaw jdq22jW98L5PcCVBHx3XcHE3UWYB1eZC6AQ5AJJ7KgK4rgHBDGNIC3LP/U22UNM8qv zWa31q374NglQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 586AAA02B3; Fri, 6 Dec 2024 00:53:17 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:29 +0800 Subject: [PATCH 03/10] of: Correct child specifier used as input of the 2nd nexus node Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241206-of_core_fix-v1-3-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu , stable@vger.kernel.org X-Mailer: b4 0.14.2 X-Proofpoint-GUID: bI027jOBE2iL0sJEEtmYBj4aX4FrwwpK X-Proofpoint-ORIG-GUID: bI027jOBE2iL0sJEEtmYBj4aX4FrwwpK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu API of_parse_phandle_with_args_map() will use wrong input for nexus node Nexus_2 as shown below: Node_1 Nexus_1 Nexus_2 &Nexus_1,arg_1 -> arg_1,&Nexus_2,arg_2' -> &Nexus_2,arg_2 -> arg_2,... map-pass-thru=3D<...> Nexus_1's output arg_2 should be used as input of Nexus_2, but the API wrongly uses arg_2' instead which !=3D arg_2 due to Nexus_1's map-pass-thru. Fix by always making @match_array point to @initial_match_array into which to store nexus output. Fixes: bd6f2fd5a1d5 ("of: Support parsing phandle argument lists through a = nexus node") Cc: stable@vger.kernel.org Signed-off-by: Zijun Hu --- drivers/of/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index b294924aa31cfed1ec06983f420a445f7fae7394..1c62cda4ebcd9e3dc5f91d10fa6= 8f975226693dd 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1542,7 +1542,6 @@ int of_parse_phandle_with_args_map(const struct devic= e_node *np, * specifier into the out_args structure, keeping the * bits specified in -map-pass-thru. */ - match_array =3D map - new_size; for (i =3D 0; i < new_size; i++) { __be32 val =3D *(map - new_size + i); =20 @@ -1551,6 +1550,7 @@ int of_parse_phandle_with_args_map(const struct devic= e_node *np, val |=3D cpu_to_be32(out_args->args[i]) & pass[i]; } =20 + initial_match_array[i] =3D val; out_args->args[i] =3D be32_to_cpu(val); } out_args->args_count =3D list_size =3D new_size; --=20 2.34.1 From nobody Thu Dec 18 00:09:50 2025 Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 78AAF193 for ; Fri, 6 Dec 2024 00:53:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446413; cv=none; b=ZBZj7dU40boRtob8pWimvDlFg4Yx55TTXZHBoyhgt6cpuYIwTiCT+Lga758QJ6+SsbLCs7ET50e382Z+SrG5cway9VCNoNZfmQcKZjj8x68l4p2UFb89WBpXUU5sde8sBG/vzXjfjkqcmHdh01beWK9/GUIBhSlgD2yiJL5U//g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446413; c=relaxed/simple; bh=FaRMEIV+exE3InCIiV8aqHdt9GbcDCRX0xauLBCBB1g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b0Dd+nmcRe4obnXvJ7WQSg65I9mA6bXFxEgDr6Y6fe2EdPMcG8Z3sXhUn4utzWbmU5x+KYHHonsqqBXOEav0HAzlLEBZkORw+zkZn6DHqKaqeg4mcBfFZezeDksR+Jiu6k3uqTMtRln2uKt4U+Gpk3zvycVuOY2SzqHxvi4zixE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=b+yW8+sX; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="b+yW8+sX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446412; bh=SO+YgkHSdNXANbZ5T5jcpT8WEiFa/mZr6j+65qv6KYM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=b+yW8+sXHX+kntqg1oF8Ua+6ejCxKtpfcYTUin21jsKCANSUKkBL51EBFuOOGTMgs nH2CYsvfkrp9o1HMVNKoFNtEG8C3qSPkMT9t5PtYekjXy7hth33T/9iu0TD8PaZgVJ F3vhQtA3JP+4/u8U6IA55PClX+LjdYrzJ0lnrDJN2hTPKH3ZbMyMbXOsX74DEp4KDY VC/lz1m6eyYP5wRmN2irCA3GRgND6lOo/YqEkepN9DgKK1BPAq2RYXJoWcBQ05dNrG GRHq8HT26NWc7yekv0f3qToW8Ttvhs/YsYFLz3MnicW7stOX6u2mElPbR1grOE/y4J UxC1KeDWzz5xQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 57FDCA028F; Fri, 6 Dec 2024 00:53:24 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:30 +0800 Subject: [PATCH 04/10] of: Fix refcount leakage for OF node returned by __of_get_dma_parent() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241206-of_core_fix-v1-4-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu , stable@vger.kernel.org X-Mailer: b4 0.14.2 X-Proofpoint-GUID: oPvYCtz1VfHG2AZPba9aShtEj8EUGgiZ X-Proofpoint-ORIG-GUID: oPvYCtz1VfHG2AZPba9aShtEj8EUGgiZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=855 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu __of_get_dma_parent() returns OF device node @args.np, but the node's refcount is increased twice, by both of_parse_phandle_with_args() and of_node_get(), so causes refcount leakage for the node. Fix by directly returning the node got by of_parse_phandle_with_args(). Fixes: f83a6e5dea6c ("of: address: Add support for the parent DMA bus") Cc: stable@vger.kernel.org Signed-off-by: Zijun Hu --- drivers/of/address.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/address.c b/drivers/of/address.c index c5b925ac469f16b8ae4b8275b60210a2d583ff83..cda1cbb82eabdcd39d32446023f= bb105b69bc99d 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -619,7 +619,7 @@ struct device_node *__of_get_dma_parent(const struct de= vice_node *np) if (ret < 0) return of_get_parent(np); =20 - return of_node_get(args.np); + return args.np; } #endif =20 --=20 2.34.1 From nobody Thu Dec 18 00:09:50 2025 Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 75D8D1DFD1 for ; Fri, 6 Dec 2024 00:53:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446420; cv=none; b=dMZf41l8uGahwShyDoN/TTzgpGKP/en9tPkSv2pSLBW7Gj9TsXYMb23BIZDDEIs9ZZ2KezQ3ac5c3/7yJxLrRxCrO+dHM8x+tVg+GNxjjBD/hhXVvke8SLKDFXsE2lglqF7VRhh5X7iWqumd13q/8fLQICBbNAYW9lGvCyThEq0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446420; c=relaxed/simple; bh=FgwvHjDGIbQG/R/BNUFvSMUMH8Fj/yPF7XlOjRUkyNY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gKNfTJbVc5XmF7MTFI6Wcwekrrhv4PEWwO40KRcAgRazb+oC1+Y+h6xAYiuSHz+Gd+qfbP6Mo5nSEsMMe6YFInMA/mcm/g7F+/jZp/LNjOqK4WuTDFdrRWys9CiLqhU7rVj4BONfTxf6s1awW/BiVw4jBKdi7P4r0bGbVuXgWrM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=pWbqZAPx; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="pWbqZAPx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446418; bh=3+suBHwqaJPwVuU9nWF9+bbade9Tamq+5YBxYiQbdDM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=pWbqZAPxRYhijtofVz4kvariE1IES6fKMu8pshJJFQuAkdHlhBqQmMmz1uHqhcG0F uiQMem94lNr2DcmjE+Yjlw71vsu1ZS3tOA7zR8loN5eZXxVTwsYJlTSndaTXeJcBrs +xZ9NXM1pse+VdUbzBoH5oN4T/Ezn1AdptUkVYSefxkZbrp5dbzASkKHLUAq7Raq8V IH7UQ+6f79gVv5ETySUhNrAhzANnGuanvhCr5/ywqSNUDT0LzaUBrLvhxolbnHHIaW e9QmwbNoqgZg8ZAk2ZgYkUfvtRd6PTbv+KhYf+ZPiKDCJZ6UKdi5imBWNh5GOmE5b1 ozkh/82CSp26A== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 11E45A02C3; Fri, 6 Dec 2024 00:53:32 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:31 +0800 Subject: [PATCH 05/10] of: Fix available buffer size calculating error in API of_device_uevent_modalias() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241206-of_core_fix-v1-5-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: K5CjjhjSYBHgKtGr_iDbQTSXbi0zQvw0 X-Proofpoint-ORIG-GUID: K5CjjhjSYBHgKtGr_iDbQTSXbi0zQvw0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=978 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu of_device_uevent_modalias() saves MODALIAS value from offset (@env->buflen - 1), so the available buffer size should be (sizeof(@env->buf) - @env->buflen + 1), but it uses the wrong size (sizeof(@env->buf) - @env->buflen). Fix by using right size (sizeof(@env->buf) - @env->buflen + 1). Fixes: dd27dcda37f0 ("of/device: merge of_device_uevent") Signed-off-by: Zijun Hu --- drivers/of/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index edf3be1972658f6dc165f577da53b10c7eebc116..ee29c07c83b9e6abd9b1c7747dd= 341026bc79eb0 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -266,10 +266,10 @@ int of_device_uevent_modalias(const struct device *de= v, struct kobj_uevent_env * return -ENOMEM; =20 sl =3D of_modalias(dev->of_node, &env->buf[env->buflen-1], - sizeof(env->buf) - env->buflen); + sizeof(env->buf) - env->buflen + 1); if (sl < 0) return sl; - if (sl >=3D (sizeof(env->buf) - env->buflen)) + if (sl >=3D (sizeof(env->buf) - env->buflen + 1)) return -ENOMEM; env->buflen +=3D sl; =20 --=20 2.34.1 From nobody Thu Dec 18 00:09:50 2025 Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 25F4574421 for ; Fri, 6 Dec 2024 00:53:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446427; cv=none; b=N7nYTCPLT4ffsRQSmwcxaD8/LWvs2O63pDQ4rpsONshFjSUJKKZbxMBGVMiHjMe2jlogS4TWdyiu+Qyr/HS4DJVz+THa0e/xdlH3XCX+2BJ2ihXKrqX1dV2xK9NtAhEdbChefrwEq/DWGRUwUmndvDoci8jGNrgZhtLo3NT1NHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446427; c=relaxed/simple; bh=Q9xVwx+mmn7ZFp9zYbGBt/qs8maxp/kG00CZiM5eHAI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jira/jBz3W7JWJxrMkeWy0cJsBpC2A4Ku6/tJqQiSpAXmg5U8zgLYR5sr/v9JT+OhRTjzYVqSgrJWnGi45CjCgECV73d/w6Wuq69A73wNs72CzYnaaTHhlO1zRQ2aMpOxfH2h/pdlraHoqNCvFrfSiiwLzMUXLeUsf+ckMte2x8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=R9wSIWxo; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="R9wSIWxo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446425; bh=h19CCu79uQPaou5AwQpkA6b+XyLa6pyMxHtnX9ZwgYY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=R9wSIWxodsjd+FrWBAWSML3aQx5b1J4EEhuCEb95I/d+3DDIBG6iLrwKcTtE8Vjxk AqXh3lepG6aA94eCND1wqvXaF90wGwzj5Sc14faR6vqwha5uuNBS1OC3ZreQa5wblG xWsxhC2cMRZ/BOXVjBOrhycvsdbGqrocoLDYtD5f5npyLjIfn4hu13p+Vh/GWSC+ng 4iwN6gMoEPFdR/o9hZ7Gmayxp4SQ5e1UsoxHOR+w8QquLDuBHhAlhAfyDYi/TkKF9Z aS/BgJH9nTRe2oMsVBGIzS7/a0EHWEbCRi3yLzEj865ldHPFeqbxUaVh7mcGJclXTk vRW5kX56p2pcg== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id B7B5BA0287; Fri, 6 Dec 2024 00:53:39 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:32 +0800 Subject: [PATCH 06/10] of/fdt: Dump __be32 array in CPU type order in of_dump_addr() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241206-of_core_fix-v1-6-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: _l3FG0YuEQ29KnYZI_r-lqY1WcqzrzaZ X-Proofpoint-ORIG-GUID: _l3FG0YuEQ29KnYZI_r-lqY1WcqzrzaZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=771 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu of_dump_addr() dumps __be32 array without conversion to CPU byte order in advance, that will reduce log readability for little endian CPUs. Fix by be32_to_cpu() conversion before dump. Signed-off-by: Zijun Hu --- drivers/of/fdt_address.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/fdt_address.c b/drivers/of/fdt_address.c index 9804d7f067056a9437d37f0b4561d79dedcc3187..1e5311f6f1858b59b99f650bcaf= a55a8d11225f9 100644 --- a/drivers/of/fdt_address.c +++ b/drivers/of/fdt_address.c @@ -28,7 +28,7 @@ static void __init of_dump_addr(const char *s, const __be= 32 *addr, int na) { pr_debug("%s", s); while(na--) - pr_cont(" %08x", *(addr++)); + pr_cont(" %08x", be32_to_cpu(*(addr++))); pr_cont("\n"); } #else --=20 2.34.1 From nobody Thu Dec 18 00:09:50 2025 Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 7A76413AD32 for ; Fri, 6 Dec 2024 00:53:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446433; cv=none; b=OVRHJYKXa1UFAUbBqe2DeBxK4qI/mDT6AtLXo0z5ReOUR6QiT6q5mmDgvLnchMLXLh/s+CpaE+sOjtHaeYPiE8zyyqL1hlpBPFy50RQpp4juT2RTbDjgbA9dH2x4+Vr8nu4K02+Fc/AKEgqfJ4gEzuigdtmC88LxXbRarc8WXOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446433; c=relaxed/simple; bh=3r59l2ZKH0fb/gjUMwsN9/pByrdyRbSqBd7pZeH+Fqw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hgIo6O4qFWqcvhsGXL/b9V9cpZfuU9+3Zp7TchS9Htu82DE1j7Alavje6yAUf496UuXJrOW2BIJ2V7PQ2oObtrbgaPMR123N3glPWtcrRQuaq9cJldGekUUcleakKoqRnhlguPEa5lr+90ujEk16ZtgjJ4Xyhj3Ph/waaFTqKsw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=jBpGd9le; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="jBpGd9le" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446432; bh=6eW1KIk0QTFVWX1i7yXwMwfKqVa+AKG/PTqwf319jEk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=jBpGd9leV4TpDMvlt7wR4rMtF2g2DydLFBQY7S+BYpS0dSSseYv+xMlS0mCmf/uF0 iBUH5cuf0Eugc2Ikokj2j+Sy5CB4ZzMolCh+mE5ku+S1tMAQ+8ytMzkWJ5nZE9nDdC DBrM8QmIq6dnfZo7vFFTioiOq+ZsIUQeWe0xE81DNTJ3yVuk0O2XjIOtvtl7dcu33K MraPlklI10JEg5GO7X7q0t0e+KvqNpnF7KWh3ix5lE+Cpn8q7rumZKNFoc+zukuDPC XzfHeGc27Ed4q7LkcMUcP1YhC5w2kMT51cATzGx2To7vP3G26IEGefWVCdbeWe99ed WQFxIFfA2LAxQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 64023A0286; Fri, 6 Dec 2024 00:53:45 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:33 +0800 Subject: [PATCH 07/10] of: Correct comments for of_alias_scan() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241206-of_core_fix-v1-7-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: 0Di-Sp0-9pGnSZP4hO3f-_yAwFawx1pf X-Proofpoint-ORIG-GUID: 0Di-Sp0-9pGnSZP4hO3f-_yAwFawx1pf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu Correct of_alias_scan() comments by: - Replace /* with /** to start comments since it is not a API. - Delete return value descriptions since it is a void function. Signed-off-by: Zijun Hu --- drivers/of/base.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 1c62cda4ebcd9e3dc5f91d10fa68f975226693dd..33abb6227468c03fd191201aa2b= be05a41fdd9f4 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1812,14 +1812,13 @@ static void of_alias_add(struct alias_prop *ap, str= uct device_node *np, ap->alias, ap->stem, ap->id, np); } =20 -/** +/* * of_alias_scan - Scan all properties of the 'aliases' node * @dt_alloc: An allocator that provides a virtual address to memory * for storing the resulting tree * * The function scans all the properties of the 'aliases' node and populat= es - * the global lookup table with the properties. It returns the - * number of alias properties found, or an error code in case of failure. + * the global lookup table with the properties. */ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) { --=20 2.34.1 From nobody Thu Dec 18 00:09:50 2025 Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 C88D4126C0A for ; Fri, 6 Dec 2024 00:53:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446441; cv=none; b=QPaU/WJ0TdCxp8hMOhVL0D0lm5MBSWjNQRtKZLWzIirhK6Lgq+vINUrH2z5JM8wo20L0IZvZMWQ3WUAZpkVBtKMSvmZEIm7RpC9yyYcu4kiTQtNirTiPRTuwQU6PrAE1/eXwGoxYLSHW6xwcX5yGIlmpKuElVm8ssxiqMLS7M/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446441; c=relaxed/simple; bh=Ve3n7niyMk1tbFP7EFflEAAnysU9QzXXKxfUINvS3wc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OFSoHanlf1cobEd7PtyfIuLQR14AfapP4oe4U7dN8Yecm6N8bUl0Q5hSB4Y9UjleL7zboswQhicWGEkqk2J62qRO7qXNdIC2T/UOftbMYVGXxywvyH/H+cuf3CZsdntbKe9V/vO61V3Tjlp/UJrodtQ+wEiTLaqRq8WNdjRh068= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=ckdP6A42; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="ckdP6A42" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446439; bh=ZlEoJI341ZSEvnqS6oDGrnWUpLJKotzXqO9H+UmL4dw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=ckdP6A421aaBj/IIvvr5OxHE1DOGGumkgD2MQrttU+nUS76oaXVBQCDBEJo4iKDMZ jpMD/hZmld5ybRG27CyiTN85poZL9ECHeXMwKKqVYKP/3SznpvQ+QalKJXUG1TamrB Qs0nbhxRl5o4kaSh09Sk1JneWVEaNMymZxOwnkdNE3zGA7kjqvi6/H+KQofFUtPjGU JEbQvBIBl2fTGzOoDnsAgmjaSuy5VuJZKktRjSrXdljBAEoZ4Dxhc81WsMtPaOnD6p cYKHawZAhU73n8kgP+g4CA1Y4mOUmjwW+B2JY9xMseErO7fr7dzMm9iuaN3a0FA3DZ RUs64ekbmjRow== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 0ECA9A0287; Fri, 6 Dec 2024 00:53:52 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:34 +0800 Subject: [PATCH 08/10] of: Swap implementation between of_property_present() and of_property_read_bool() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241206-of_core_fix-v1-8-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: PXcWkQ90dxDs5MfUk7htivn02RgapTAS X-Proofpoint-ORIG-GUID: PXcWkQ90dxDs5MfUk7htivn02RgapTAS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=857 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu of_property_present() is exactly same as of_property_read_bool(). Swap their implementation to make them more logical as shown below: find property -> property is present or not -> boolean property value. Signed-off-by: Zijun Hu --- include/linux/of.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/include/linux/of.h b/include/linux/of.h index f921786cb8ac782286ed5ff4425a35668204d050..7b0da8d352dffd8b87299890328= 2119b6164a5bc 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -1243,17 +1243,16 @@ static inline int of_property_read_string_index(con= st struct device_node *np, } =20 /** - * of_property_read_bool - Find a property - * @np: device node from which the property value is to be read. + * of_property_present - Test if a property is present in a node + * @np: device node to search for the property. * @propname: name of the property to be searched. * - * Search for a boolean property in a device node. Usage on non-boolean - * property types is deprecated. + * Test for a property present in a device node. * * Return: true if the property exists false otherwise. */ -static inline bool of_property_read_bool(const struct device_node *np, - const char *propname) +static inline bool of_property_present(const struct device_node *np, + const char *propname) { const struct property *prop =3D of_find_property(np, propname, NULL); =20 @@ -1261,17 +1260,19 @@ static inline bool of_property_read_bool(const stru= ct device_node *np, } =20 /** - * of_property_present - Test if a property is present in a node - * @np: device node to search for the property. + * of_property_read_bool - Find a property + * @np: device node from which the property value is to be read. * @propname: name of the property to be searched. * - * Test for a property present in a device node. + * Search for a boolean property in a device node. Usage on non-boolean + * property types is deprecated. * * Return: true if the property exists false otherwise. */ -static inline bool of_property_present(const struct device_node *np, const= char *propname) +static inline bool of_property_read_bool(const struct device_node *np, + const char *propname) { - return of_property_read_bool(np, propname); + return of_property_present(np, propname); } =20 /** --=20 2.34.1 From nobody Thu Dec 18 00:09:50 2025 Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 7350813C677 for ; Fri, 6 Dec 2024 00:54:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446447; cv=none; b=Kq5OyPrTG8/BSYNyQH57XtODnkGNjVzh6tRdmLFZvIn0xwbJ4TlhaI6BvtIVFNSd+zhkptv4RzyOLKlBpLycxQTaHGyfrA5JzANZGejHKowtD9uVM9qrGgF/8FEeMCob1/DbNpu1kyZ1JCB5w4fvW3VDjuDzkRzRCFlOP3/yJac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446447; c=relaxed/simple; bh=p2uJy5wlhcAeH29QIKPJq4WBggZbGwCXj0DgoGtnco8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OoR0vLPwqdMD/51F/knFIgktbXhjLQiT2rlX9h9fpnDfVxFwyCmATtRrIxw1aeolPEJQNb07PC8a7kuJz6CUxlmKtupMXjYJODqq/04jaG+x2kajzEml2/GABHpmz29Gw8Wf/YHJUyFVHRXZcLEHXZQQAGb7qf9tensccMvagIA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=C52GUwAS; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="C52GUwAS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446446; bh=v8GTvyAKaega/LEBXEiMnIjJ5Doyy9iyoBrZIPFUfM0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=C52GUwASzYXmvwiAOuLkCT07bTBEy+zo30Uynnca1KTn+h5/hQLzmOwTQEY2r7Hnf D3v7fnp/cF250qBRdelu10XQ1m0EEv9N/Sb4E1BfPLCKmRWfS5DjXCP2DzukuAFXXh QpAmAXrmzEw2ZTHlnb9vWYYrchT0brh6gTu+j5UtULsK40gDCYij0wBfkIzf6csPrx r7y+8s+nOU2Wiqzv9TVQFRqsDMmfkJDLjaJ8q0tCGHBGMU23BAILCZjAsl8RbjkdyC taEp65XrsnhwrNYyWOROAOlOptEfEk7LX7OvpydQ7MpCokCAgnkse7VshHShWQR9oF h0Ue6bNhI4tEQ== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 5F27AA029A; Fri, 6 Dec 2024 00:53:59 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:35 +0800 Subject: [PATCH 09/10] of: property: Implement of_fwnode_property_present() by of_property_present() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241206-of_core_fix-v1-9-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: y32qnoVcQ2pobTvnBj3XT4sfiocRSh8W X-Proofpoint-ORIG-GUID: y32qnoVcQ2pobTvnBj3XT4sfiocRSh8W X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=862 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu of_property_read_bool() is deprecated for non-boolean property, but of_fwnode_property_present() still uses it. Fix by using of_property_present() instead of of_property_read_bool(). Signed-off-by: Zijun Hu --- drivers/of/property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/property.c b/drivers/of/property.c index 519bf9229e613906547b57d8c68e7b8558eff327..dca1a3ebccae1093b2b11f51e8e= 692bca854d0e3 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -966,7 +966,7 @@ of_fwnode_device_get_dma_attr(const struct fwnode_handl= e *fwnode) static bool of_fwnode_property_present(const struct fwnode_handle *fwnode, const char *propname) { - return of_property_read_bool(to_of_node(fwnode), propname); + return of_property_present(to_of_node(fwnode), propname); } =20 static int of_fwnode_property_read_int_array(const struct fwnode_handle *f= wnode, --=20 2.34.1 From nobody Thu Dec 18 00:09:50 2025 Received: from pv50p00im-ztdg10012001.me.com (pv50p00im-ztdg10012001.me.com [17.58.6.51]) (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 445D147F53 for ; Fri, 6 Dec 2024 00:54:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=17.58.6.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446454; cv=none; b=Ds88OT1qKVzfvlv54a9UplrRRRk0tpEKborySgM9UsTls025ntq9LjMH4UavGSwKbR+quMB+0w3iihqeNb1assdPuiOklqUxxfwkZcrN5n9AAHXHKv5qyV7RVgsv6XIoPCpSAGAE5UgDZgruAWAv3183JcJYyUWcLv9Ny2MposE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733446454; c=relaxed/simple; bh=4gGpUxc+ueLe/9s3H5w03yxhgZr4jHYyf/gMsxtAANU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XfIwxUbbheqhlR7oO45PGLwL5Atf70Z+7hDZufXYcSOjtDfZp8Kj1gqrstuvlpVIVRC/c2XpGm627lr3XSmgRd1UopF/xNWIRoF3WQZCEvgALDZoJVLKP9KyP1lYXzFRClmONbFnNN6WEuOobeUE8eYzc0UCG+zdqs0SQV9+beI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com; spf=pass smtp.mailfrom=icloud.com; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b=AC8Exnno; arc=none smtp.client-ip=17.58.6.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=icloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=icloud.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="AC8Exnno" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1733446452; bh=GcCykD0GR82c2pG2Xkejm3Z3BIkCqKMX+zNiZjv69I0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To: x-icloud-hme; b=AC8Exnnoz0LrM2fmLtefB52Ri8YOch6woOLhBi9pH8zAgZx9OTBiNPPVz7vS6fIaP +yc9rr3bXLdI8yxrmhaXRU2ZUcRF7csGrc3O61Y+Ncd8bOQZVY2Bn9PgmzmuTW2avf N4Twwi3WqzqxESz5ZIL5ahagWYNCQfCwK+9jhkgPwq2ro0TZenLqt8Q/MMn2TINbYf PJDcdseLyL7Gw7JwVChUarLa/AzmiQOCxPm++laJk9RUws6nw/in2IPFBKL9Z5acxN bhs95pjPbbLvfLJr2/KcqqEZIegDPSBnqYIei8t2mXYRGz9jKuIuBTvBTqqOjD7+dq LxkPMou//d5ew== Received: from [192.168.1.26] (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10012001.me.com (Postfix) with ESMTPSA id 0E386A01E8; Fri, 6 Dec 2024 00:54:06 +0000 (UTC) From: Zijun Hu Date: Fri, 06 Dec 2024 08:52:36 +0800 Subject: [PATCH 10/10] of: Simplify API of_find_node_with_property() implementation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241206-of_core_fix-v1-10-dc28ed56bec3@quicinc.com> References: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> In-Reply-To: <20241206-of_core_fix-v1-0-dc28ed56bec3@quicinc.com> To: Rob Herring , Saravana Kannan , Leif Lindholm , Stephen Boyd , Maxime Ripard , Robin Murphy , Grant Likely Cc: Zijun Hu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Zijun Hu X-Mailer: b4 0.14.2 X-Proofpoint-GUID: -03kjP29dKbBOXPMmppkSPOOwTG3W9wv X-Proofpoint-ORIG-GUID: -03kjP29dKbBOXPMmppkSPOOwTG3W9wv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2024-12-05_16,2024-12-05_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=965 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2412060006 X-Apple-Remote-Links: v=1;h=KCk=;charset=UTF-8 From: Zijun Hu Simplify of_find_node_with_property() implementation by __of_find_property(). Signed-off-by: Zijun Hu --- drivers/of/base.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 33abb6227468c03fd191201aa2bbe05a41fdd9f4..5fc061b66116d106c398f04a1d9= d235f09741de7 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1026,19 +1026,15 @@ struct device_node *of_find_node_with_property(stru= ct device_node *from, const char *prop_name) { struct device_node *np; - const struct property *pp; unsigned long flags; =20 raw_spin_lock_irqsave(&devtree_lock, flags); for_each_of_allnodes_from(from, np) { - for (pp =3D np->properties; pp; pp =3D pp->next) { - if (of_prop_cmp(pp->name, prop_name) =3D=3D 0) { - of_node_get(np); - goto out; - } + if (__of_find_property(np, prop_name, NULL)) { + of_node_get(np); + break; } } -out: of_node_put(from); raw_spin_unlock_irqrestore(&devtree_lock, flags); return np; --=20 2.34.1