From patchwork Tue Jan 26 01:51:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 370851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A0C1C4361A for ; Tue, 26 Jan 2021 04:50:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B9BA22B3B for ; Tue, 26 Jan 2021 04:50:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728311AbhAZEtu (ORCPT ); Mon, 25 Jan 2021 23:49:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732029AbhAZCDZ (ORCPT ); Mon, 25 Jan 2021 21:03:25 -0500 X-Greylist: delayed 555 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 25 Jan 2021 18:02:08 PST Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [IPv6:2001:df5:b000:5::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D0D8C061225 for ; Mon, 25 Jan 2021 18:02:08 -0800 (PST) Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 14A1283646; Tue, 26 Jan 2021 14:52:02 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1611625922; bh=oP2TIidX81eGT1h2x2myyqVlxaXwQ5UVYXVVX5Ngep0=; h=From:To:Cc:Subject:Date; b=h+YiTMWssfTinGHD8tqDCQYgSS5axw4LFeegeYEH4pU+Ro3vr63wmG4O5Sregpto7 sqAXeHBp/7uTcONZcXDLRojaXsApegUg4n+zFkVGlMGtK2oQBj0wJrgXViOuP0OA2A oPUQsoMMqy6jbLZWdEVDGCCQqeXZ4XqE8p5YkoY/OP3AWZ+vDf0ze9LduqCv/mq+vP THoZAimk3DyIKaegsBOpHMukbNdL8oGNPGv2N+z/0hHyfLetUt+aCYKAVtD2MMJtQW KNfXSO0m39xZSV5mwOZZQE1VYA2EKVXsMOax2dA4kJjOU/Z69QXjae5bCIqJrayk+5 Nuj4Gp+joQFdA== Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7, 5, 8, 10121) id ; Tue, 26 Jan 2021 14:52:01 +1300 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.20]) by smtp (Postfix) with ESMTP id E3FD013EECA; Tue, 26 Jan 2021 14:52:03 +1300 (NZDT) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id D2917288C85; Tue, 26 Jan 2021 14:52:01 +1300 (NZDT) From: Chris Packham To: robh+dt@kernel.org, frowand.list@gmail.com, arch0.zheng@gmail.com Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Packham Subject: [PATCH] of/fdt: Check against '/chosen' in early_init_dt_scan_chosen Date: Tue, 26 Jan 2021 14:51:59 +1300 Message-Id: <20210126015159.23923-1-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 x-atlnz-ls: pat Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org of_scan_flat_dt() passes the name of the visited node to the iterator. In the case of '/chosen' this includes the leading '/'. Update early_init_dt_scan_chosen() to expect this. Fixes: 7536c7e03e74 ("of/fdt: Remove redundant kbasename function call") Signed-off-by: Chris Packham --- drivers/of/fdt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index feb0f2d67fc5..861aedf0bb7c 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -1043,7 +1043,10 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname); if (depth != 1 || !data || - (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) + (strcmp(uname, "chosen") != 0 && + strcmp(uname, "chosen@0") != 0 && + strcmp(uname, "/chosen") != 0 && + strcmp(uname, "/chosen@0") != 0)) return 0; early_init_dt_check_for_initrd(node);