From patchwork Fri Dec 6 00:52:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zijun Hu X-Patchwork-Id: 2019007 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=icloud.com header.i=@icloud.com header.a=rsa-sha256 header.s=1a1hai header.b=lDypAx2r; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.80.249; helo=am.mirrors.kernel.org; envelope-from=devicetree+bounces-127738-incoming-dt=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y4CSS03ylz1yRK for ; Fri, 6 Dec 2024 11:54:00 +1100 (AEDT) Received: from smtp.subspace.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 724221884570 for ; Fri, 6 Dec 2024 00:53:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70E70126C04; Fri, 6 Dec 2024 00:53:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=icloud.com header.i=@icloud.com header.b="lDypAx2r" X-Original-To: devicetree@vger.kernel.org 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 EC80E80BF8 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 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: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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=<...> Nexus_1's output arg_2 should be used as input of Nexus_2, but the API wrongly uses arg_2' instead which != 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..1c62cda4ebcd9e3dc5f91d10fa68f975226693dd 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1542,7 +1542,6 @@ int of_parse_phandle_with_args_map(const struct device_node *np, * specifier into the out_args structure, keeping the * bits specified in -map-pass-thru. */ - match_array = map - new_size; for (i = 0; i < new_size; i++) { __be32 val = *(map - new_size + i); @@ -1551,6 +1550,7 @@ int of_parse_phandle_with_args_map(const struct device_node *np, val |= cpu_to_be32(out_args->args[i]) & pass[i]; } + initial_match_array[i] = val; out_args->args[i] = be32_to_cpu(val); } out_args->args_count = list_size = new_size;