Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2525280rdd; Fri, 12 Jan 2024 12:09:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGwNnF2/3bD0PfqVW417QZSsV5VSrnu2qh32HeV/ZLKloymVIBEa2dblGjduPQlDGpRJKs0 X-Received: by 2002:a05:6214:130d:b0:681:22fd:4e66 with SMTP id pn13-20020a056214130d00b0068122fd4e66mr1849143qvb.38.1705090154808; Fri, 12 Jan 2024 12:09:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705090154; cv=none; d=google.com; s=arc-20160816; b=kXbipDIoF3tzhFWRT6dVo3bvh+c7QQ9LMwINQuyoUzL/AolT0anFqbPSwfwjgh1Csg oGOIGKvZZwiLcCPQNq4hKaEL11mwjNNVjRSa52idMCcbw5/FsONhDN88Q5s+nRQq5YlQ KHWuNXoqxFynAVBdQxA3AFPwZabY2HzWmuicdM7EO4xDvFJTibHauqCwrDpVcHUtMcjk Gd9Je2u43+8E9npKiu758Qkm2pXAMsME54OXucmWYcmWa8yegzWegebUzEcUf1xWGbAi uKewCJerk87J/ly8OR4eF5aGShm5OeSFPOd896F3xkpSMMS4rdwa5u4YUeKHnNBgTYi7 Mf6g== ARC-Message-Signature: i=1; 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=Vxm7GroJb1jr7a7SKxct7zVVLJ9MIYxfQSDNcHJxJs8=; fh=R/gIXN/nmdWOBYt8u4a8BOYYdlFigy1MtQckky2cQ+g=; b=eFmfJX6JBdL/peBtt8ecUXRwfk+b7sXsriLI6rgkur/DQWoToa6ZlpTQlFJO5hr3Hr eKApM6kmpJvtMtgcXhjhPRHQoHZszpphjd0G0bR28TvtBCJFL7UgIVHjtk2A7dqZIuA5 ce5l7wIfbEuM+FEo4pgtfSkBJ06hF75rKY6m1xX72aDld7oiC67uyP20dCsgmHkW1tvn rM1hGQ3CSmB4FEWNISyDlDVxa+OAoTPIYMxo0YSTaRot1Th050RvKxXHLwiSLYbZdXX0 0V7ZEeILjjHDSdgmUaRukwR49lBRxk2ZiRqUcAjwEARK2ovyWWegL0EXhVSZWwL626vT 1gQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y8kgwibd; spf=pass (google.com: domain of linux-kernel+bounces-25018-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25018-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n9-20020a0ce489000000b0067ec2d04818si3355612qvl.131.2024.01.12.12.09.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 12:09:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25018-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y8kgwibd; spf=pass (google.com: domain of linux-kernel+bounces-25018-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25018-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8F1D31C2189E for ; Fri, 12 Jan 2024 20:09:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B326317751; Fri, 12 Jan 2024 20:07:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y8kgwibd" 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 A87D8171BE; Fri, 12 Jan 2024 20:07:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC66AC43601; Fri, 12 Jan 2024 20:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705090075; bh=QNmBS0brQeJSjUserQhzHk2Vt2IzcbhX82b9CN/v9CM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y8kgwibdxmE4vap0GuM/fVQuLavqIYEsi/kkmbe/DQ87QPH+0t1CqfbhrLlhb1UL7 HsKrA+qsZUl+LD2qh7XyoCRY68FeKquq9mWHhynzJkscVBNamnfsdrIokEUGS67SUs DPI8umccncrhCQPBTmfFVD9pIDflhg54WSTK/c+AFyumnZWqevRYptze5nxWAy/OKp yE/oFcwKeA8aWm8KE6nIeYSdurXI9VBChIHzWI0MMjdlCRZFqlE+p5Iv5QKxv/AAjV S9tenjVL7krLEEJ9qqZGhYxmpGtuN3+CCUhplyCBQyMn8i0jOHxtZGOf4SS6LTk4Eq iAbnScBTZWkxw== 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 5/6] of: unittest: treat missing of_root as error instead of fixing up Date: Fri, 12 Jan 2024 12:07:48 -0800 Message-ID: <20240112200750.4062441-6-sboyd@kernel.org> X-Mailer: git-send-email 2.43.0.275.g3460e3d667-goog In-Reply-To: <20240112200750.4062441-1-sboyd@kernel.org> References: <20240112200750.4062441-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 a8b27dd16ecf..742d919e8ab4 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -1732,20 +1732,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