From patchwork Fri Jan 12 20:07:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 187823 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp415190dyc; Fri, 12 Jan 2024 12:11:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IHy3jIKuyAUQIfbJOwvclmeTEc9W+rL1wzfmLOl7AAyv95EgF83guSF/CpYfI619FO7OPAH X-Received: by 2002:aa7:88cc:0:b0:6da:e711:7836 with SMTP id k12-20020aa788cc000000b006dae7117836mr1649797pff.54.1705090293291; Fri, 12 Jan 2024 12:11:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705090293; cv=none; d=google.com; s=arc-20160816; b=CXAZ8UXfZB5UBqFomKHIe/48QkXL+8qsA7ANEbIgKxrmP5gJ32xDzSESSplGzvB57X kHh2w7aeRRrEsR3LwralBmg9eorMuaTrK87EvucwPinAkcPJgP4NHonDqEvXfxQd6Fhd zkdfCUaWG5jjE7dIjoPr/cNH1ZuE9Ad/YN388xirX5RWOR5v/JXZpz7SskdFG+ktLbfu M2GyuszfFdpTbEnc60Yv76dn0S0NWQA+qwCsfbQpn6mwgNpFKnbjZptspdqHmZ1FEx7x Cxl9MZ9DOc7+qy7T0D6x5jQZahLftInb4sIV7+RBVlE6EBmSQouSegm4Y234i9hy9/yd Zc7g== 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25018-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id m25-20020a637119000000b005cda25b2bedsi3789012pgc.430.2024.01.12.12.11.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 12:11:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25018-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25018-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B1419B22ECD for ; Fri, 12 Jan 2024 20:09:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 885BE18021; Fri, 12 Jan 2024 20:07:58 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787916759357607554 X-GMAIL-MSGID: 1787916759357607554 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;