From patchwork Tue Jun 11 11:19:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang W X-Patchwork-Id: 1946249 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ntassoQ1; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=CWPJkAC5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vz5n63jkcz23v2 for ; Tue, 11 Jun 2024 21:20:10 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3+C8k6npYyb3wlAl17PMr72AXeK/bueRSKsentu790s=; b=ntassoQ1zzO5Su VHHXX5JEhSU6YukiNf/UEbDVHPBglyMPf0BE6M4BKQchLelmjGuiTlgES1JmQ6jYtntOBQytptyL9 qXtJf3AdeCIMJuc7HXHfK0IG6D7gxl6PLu39+s0QV++FI2TIJePvirYIPlV6NdWGh1395f+j5Udh6 dQpjo08R0SAk/+94H0ic6lD8jlpiUpKNWIbetEiN7ubKXST77osWnjIFUd35Vsvesj/JRugX+Y1Mz s61F9apNxgygx1BYUz1Xaqfm3l6ux2OMcuYuHPw23njTU/ObHleHTX0OZIcw79Bfuuz+d7h8/KS+r qSquKmWDs7X3QgyOofjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGzXl-00000008bYS-0pAA; Tue, 11 Jun 2024 11:20:01 +0000 Received: from m16.mail.126.com ([220.197.31.9]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGzXc-00000008bUS-2WNx for opensbi@lists.infradead.org; Tue, 11 Jun 2024 11:19:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=Pw3zf UnMEbg4SToboMK+3PDVO7u0/MStILRNnRzB8EA=; b=CWPJkAC5MHpF4J8rqHFt8 s0yhBOXwfmaUZwUjkWtkKm/g75WHgrrbJSLufrnYduU+D+C4HE/2nSOooFruTUf7 J95n445lowO9BbVfX1yZ6IfOCjhWGe97D7OOFEnsROBZs056Qm8ymFDwaN4ATXac SrwfW7/3abK0TdM1Lr1wjU= Received: from T490.lan (unknown [112.83.182.153]) by gzga-smtp-mta-g1-2 (Coremail) with SMTP id _____wD3X1XLMmhm1zYvDA--.56663S9; Tue, 11 Jun 2024 19:19:43 +0800 (CST) From: Xiang W To: opensbi@lists.infradead.org Cc: Xiang W , anup@brainfault.org Subject: [PATCH 7/7] lib: utils/reset: Fix fdt_reset to search for more dt nodes Date: Tue, 11 Jun 2024 19:19:34 +0800 Message-ID: <20240611111937.1459876-8-wxjstz@126.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240611111937.1459876-1-wxjstz@126.com> References: <20240611111937.1459876-1-wxjstz@126.com> MIME-Version: 1.0 X-CM-TRANSID: _____wD3X1XLMmhm1zYvDA--.56663S9 X-Coremail-Antispam: 1Uf129KBjvJXoWrKF1DCr4UCrykZFyxuFWkXrb_yoW8JF4rpw 13Ja4av3s3X3y09rsag393Zw1FvF4ftw17XrZ3CF1xJr97W3yUXry8tFy7JF93ZrWrAFya yrs0qF92kFn5WrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zEhL08UUUUU= X-Originating-IP: [112.83.182.153] X-CM-SenderInfo: pz0m23b26rjloofrz/1tbiIRP6OmVLaMOwSwAAsM X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240611_041953_231277_6BC7AB2D X-CRM114-Status: UNSURE ( 8.46 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: If there are multiple dt nodes, the previous code only tries to match the first one, which may lose initialization. Signed-off-by: Xiang W --- lib/utils/reset/fdt_reset.c | 24 ++++++++++++ 1 file changed, 12 insertions(+), 12 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [220.197.31.9 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [wxjstz(at)126.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org If there are multiple dt nodes, the previous code only tries to match the first one, which may lose initialization. Signed-off-by: Xiang W Reviewed-by: Anup Patel --- lib/utils/reset/fdt_reset.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/utils/reset/fdt_reset.c b/lib/utils/reset/fdt_reset.c index 327fb99..df67da1 100644 --- a/lib/utils/reset/fdt_reset.c +++ b/lib/utils/reset/fdt_reset.c @@ -22,18 +22,18 @@ int fdt_reset_driver_init(void *fdt, struct fdt_reset *drv) int noff, rc = SBI_ENODEV; const struct fdt_match *match; - noff = fdt_find_match(fdt, -1, drv->match_table, &match); - if (noff < 0) - return SBI_ENODEV; - - if (!fdt_node_is_enabled(fdt, noff)) - return SBI_ENODEV; - - if (drv->init) { - rc = drv->init(fdt, noff, match); - if (rc && rc != SBI_ENODEV) { - sbi_printf("%s: %s init failed, %d\n", - __func__, match->compatible, rc); + noff = -1; + while ((noff = fdt_find_match(fdt, noff, + drv->match_table, &match)) >= 0) { + if (!fdt_node_is_enabled(fdt, noff)) + continue; + + if (drv->init) { + rc = drv->init(fdt, noff, match); + if (rc && rc != SBI_ENODEV) { + sbi_printf("%s: %s init failed, %d\n", + __func__, match->compatible, rc); + } } }