Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1447037rdb; Fri, 16 Feb 2024 17:10:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUY26F/xXI1WUXlNFGsQEUIe2iVEafbLHWZWJMIwMmMYeUEGfTMV07Tl4Kb7koK40UbYKhh6RkudTizflAPMc87Ev5p2apoY/HbxLT5sw== X-Google-Smtp-Source: AGHT+IFAtET626fn8q7/XwERBhV7/7GxC9NcGXcQ4NiUm09GR5BTVwmF0Gyu+3Iq9QsaYVzAPJpz X-Received: by 2002:a17:902:f711:b0:1db:ad25:488 with SMTP id h17-20020a170902f71100b001dbad250488mr3220177plo.19.1708132228967; Fri, 16 Feb 2024 17:10:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708132228; cv=pass; d=google.com; s=arc-20160816; b=GVrCaNvPP4pKto1b3Xec4uxN++fZ+ADqbvJLNiPjlopejMXeyLsFGYGupLOgho0XrK YZAcyrCZHDfyV74feJ51oZ2qTxS7BXAMS8lLEIGvav0ASVyW1w+3UALZvAiAw/P3VwYD Mi9fy4B+xbOmIa4mlm2pmkk3UB/kFc7QvSzCZyLsARuMBbEV9X/5ogaoeAQiheL43jYh MOQRpPqdg4dVFP/dM9yj7raM7KcMtqSAefrEChRtyzIPg0BtjD5GfIXhY2sUC4W5rCOu ipp0LAjoe+jwdIMP36dVZIFHen+n86hYNxXyls6pxdqHpCLfM8fnSHQ3lUkuQOFsh7RB +kTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ltXg5dLqXeEAw0B9ekuGlp0meqmOfPS4K+bnj0EGYEw=; fh=R/gIXN/nmdWOBYt8u4a8BOYYdlFigy1MtQckky2cQ+g=; b=ElKO8nPbfNoxw4lKRe6B3p37wuScc7iQKgeyE7nMLwz6jJ5IpzNFm965dzKf6IPOkK APRhwB1ejD+0DkHA9j6EpW3CwVJxs32b3swn7+CceS9DCYY0VvdYoIitOsC8kCKzErAQ 1TJVjbRqFD6qX/El9nGrhpCs0TvWVj8Wc2zYx6d9Ja2JUmgsxEJtv3OntYmR7lsHfK4q OszAUfBddGzWCo9M//MyBtnXELu6df6bR3aheD/+YVxn5fvcKRwz49AfrdNk/G6jxWwc z+TysCyDdloygKl8xdAhwOpohY3DibXEm5S+zt+Xdhd5DRXVhaGOYz8XqXht/XXLmaBe odhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fR7K0DPm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-69631-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u6-20020a170902b28600b001db28ba8ca0si680874plr.54.2024.02.16.17.10.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 17:10:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69631-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fR7K0DPm; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-69631-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 14B98284AFF for ; Sat, 17 Feb 2024 01:10:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01F6721A1C; Sat, 17 Feb 2024 01:06:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fR7K0DPm" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 204FB20DC8; Sat, 17 Feb 2024 01:06:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708131963; cv=none; b=RE73TTL+6qFg/1fDj7myE63Rrv+tWv9jr9giny4sYddvPJg2UWj8tX7fqhC52aTWcEclOHksiNq+DTbAAosi7Bg2+tyTCQeXl+eloE+NES2iE0Be6VqDxIS1BMMdbdlJmMIQ1SyD8v2ZFvLEPWkOpgaFjHqzGeneMYeMjJLeEHA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708131963; c=relaxed/simple; bh=a4ZJdi1g6SmL1slfPXA0Sdc1BiW+RCSDLbBzSuVLxg0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=amxE400CZoowsYw2zfkccLCxp1YC3F4ttIa8iOZILzt8MUB4b0Id6ZmxwrPwWrUGS3BHawDBfk3NcQDHnCidSL0mMUdRCxnOwpvajLfKrO+jGHmnjphmDOcxcj8K+gEtL+wN8uWVljmTlnMKV7cjqD6rpBaB/M/+oixXJX1J57o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fR7K0DPm; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 294E0C43394; Sat, 17 Feb 2024 01:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708131962; bh=a4ZJdi1g6SmL1slfPXA0Sdc1BiW+RCSDLbBzSuVLxg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fR7K0DPmwLwliOjcvLTQMYx/yhvXd+Lt+J20YtU0eJg9BBupTobaTXvHDKz0ElN1w lyN91Teoqb6L2FiUFaTin94ppj2bXx/OQ+5Zh9nlGBCkw98caMK44i80kS9zuogCk7 mhCc644572dUf8Iq4dDijMBDhsqAR1qvwJuMq095NWCspfbOK6Sumcdd6hlvus4rY5 pJtJzorxKorAn51SisFu2bSBgpRVzJ6rZw7i2j2hIexRCBfO1hTtdhdRp1aExld7zC LS7kGmSBV76MFa+4KC96o2AvD8CCs6u81WWqcJQR/bglZGe4WFTGsxvKciZGKD270o ma7B4X6MmNn+A== From: Stephen Boyd To: Rob Herring Cc: Frank Rowand , linux-kernel@vger.kernel.org, patches@lists.linux.dev, linux-um@lists.infradead.org, linux-arm-kernel@lists.infradead.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 6/7] of: unittest: treat missing of_root as error instead of fixing up Date: Fri, 16 Feb 2024 17:05:55 -0800 Message-ID: <20240217010557.2381548-7-sboyd@kernel.org> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog In-Reply-To: <20240217010557.2381548-1-sboyd@kernel.org> References: <20240217010557.2381548-1-sboyd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Frank Rowand unflatten_device_tree() now ensures that the 'of_root' node is populated with the root of a default empty devicetree. Remove the unittest code that created 'of_root' if it was missing. Verify that 'of_root' is valid before attempting to attach the testcase-data subtree. Remove the unittest code that unflattens the unittest overlay base if architecture is UML because that is always done now. Signed-off-by: Frank Rowand Link: https://lore.kernel.org/r/20230317053415.2254616-3-frowand.list@gmail.com Cc: Rob Herring Signed-off-by: Stephen Boyd --- drivers/of/unittest.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 891752a20a5f..4c67de37bf26 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -1744,20 +1744,16 @@ static int __init unittest_data_add(void) return -EINVAL; } + /* attach the sub-tree to live tree */ if (!of_root) { - of_root = unittest_data_node; - for_each_of_allnodes(np) - __of_attach_node_sysfs(np); - of_aliases = of_find_node_by_path("/aliases"); - of_chosen = of_find_node_by_path("/chosen"); - of_overlay_mutex_unlock(); - return 0; + pr_warn("%s: no live tree to attach sub-tree\n", __func__); + kfree(unittest_data); + return -ENODEV; } EXPECT_BEGIN(KERN_INFO, "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); - /* attach the sub-tree to live tree */ np = unittest_data_node->child; while (np) { struct device_node *next = np->sibling; -- https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git/ https://git.kernel.org/pub/scm/linux/kernel/git/sboyd/spmi.git