From patchwork Fri Feb 2 19:59:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 196017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp668514dyc; Fri, 2 Feb 2024 12:01:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IG99/otXhsNZqUFBnUA0ZSimgpbOujhCuytGCerCEib21nAuOWOmgmeEcSfZx4zEdcv/JTi X-Received: by 2002:a17:903:4289:b0:1d8:d6f2:5ee0 with SMTP id ju9-20020a170903428900b001d8d6f25ee0mr6502426plb.8.1706904089110; Fri, 02 Feb 2024 12:01:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706904089; cv=pass; d=google.com; s=arc-20160816; b=v0IqDDMDQA+KZ7+MYwAyvZNs/3WH9P7RREKGWHxl9agJ4bYFxxeTm/R0q8olsM1stw y+xafJlJg7dd/s39d10KnubeTfj7/DqqUbruorya54UoQ2wflwgqneKq8bW18AVa20p/ 4xv+gFeInyJ+hsgwpvSlMyxMAk0Ru9kD5QzizA7ZTHUvwoxM9qm5iuGJ/vHPSC7QTkzI TN3ju/eaOLfVMZbkef2vIFWJtt9chiagW/PnbySVTifYsupvTM4bvfFyaqTOSVYcPQLn x9V8mT/xt59PvFHMQPdAOcdMZ96e+pv7/ee2OBYaLtR9v6kCic2UJxBmHauf8PJZpDZh XARQ== 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=Vxm7GroJb1jr7a7SKxct7zVVLJ9MIYxfQSDNcHJxJs8=; fh=+eNSuoHAPUHx6ftvK6JyMPCiLtoCbLqExckzJHX/pR0=; b=ozkupklV5M5/Aou3iSDdWEI3K+tHObc337ISjxjbskgn3LaO5PjVuVQHjcKgtn64/b YWGJ3XODm9r+JeUKmOWbh1Ayagk+JYYvnpfGVQRQKbOXLdjm0QwFTG7d0PY8joiW3EvB 3/OuniK95mVXkqp2DvEA7oT7H+3J86WIyCwIJM8ek1bWVoCcGWtOwdx0n6v4ssYCRQPV 3KjpXm6YCcWsRDJFWmCyFck23ay+ya+Ar9CJBlJ2PRAPelUk1VtYGbXT8UW1iuHDbFNc Rp+KiQPlnO1p6/EekzqtE/5Xi10FGklud6WYnhd3EPh4TUsYQI88+v/zL3twxoM5vU7R zA3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rqr1TVIk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-50515-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50515-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUjulWnYpScXoBYj6pbh0YP6LCjDNAm3AQATRBPGolb2tXRykWLoZh/12+ZYI1cilj+ta0AUvAV93qQ4jfXJv9bqjT3/A== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d6-20020a170903230600b001d70fef0d09si2309858plh.52.2024.02.02.12.01.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 12:01:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50515-ouuuleilei=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=rqr1TVIk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-50515-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50515-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id DC8E028D102 for ; Fri, 2 Feb 2024 20:01:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0E1912C7F0; Fri, 2 Feb 2024 19:59:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rqr1TVIk" 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 0465485929; Fri, 2 Feb 2024 19:59:15 +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=1706903956; cv=none; b=eRb7AJQOiPgL/JnlJcDNDsfNEdR4t/Uw9hMDQV79yX22a2BrxoYp5TpIfxLKVZ8oXlaEkNeGE3KTQQCc8Gbq4xmkSPn/0+/YHA6kME+aaTIU3QFnFCIC7qIymIR6goR/qhrBd/vIRuE+6TjHr74s5IEqWOzHTnUwXayqKP34Mfs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706903956; c=relaxed/simple; bh=QNmBS0brQeJSjUserQhzHk2Vt2IzcbhX82b9CN/v9CM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g7/jreHac22fAhfkEtVSnWkp1hNn1GMUX7S7YYIPWGJzlFOD91MZgAZ3tboTw8kFxVhVldPTJWwivsTvOyTxH5mAD6WhAvrHxGXyV3XJZOhD1MlGlMDDXoNttc7t2msE7pIPtOe+AzvNblT3qWHMaSHQ4bH9r/l+XMb7PVZZdIo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rqr1TVIk; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EB81C43141; Fri, 2 Feb 2024 19:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706903955; bh=QNmBS0brQeJSjUserQhzHk2Vt2IzcbhX82b9CN/v9CM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rqr1TVIkELbYe8QcCaThgPp5LfWi4EUBvIMppFR3VVYloXIkVaSj1nLdUvXnARg9u W4AepGXy6uRZGg2L9PFyE7fy9ii7eFqT6dlWogyio4PE7QIoBYNy7tMnDPJ8UfC7hG XFbmaFzRY/46VmL/ZfeffKX1wCpke+epxasSxyVyG3ZE8GhMyOB43ybYp65Se6knYS adbMjrvYBVdu4eZEpmkn75FnBt+KEP63nyZeBhz6u4l5XoVWgDQlttPxbupz2oLhsm s7YXw3hJ2rRF52Uz2vwU3YR5WfwgKeeO2H4/PfvHfC78HwzoSD7g5UczgKO8C9fD6x i93LlSW/kUN1g== 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 v3 6/7] of: unittest: treat missing of_root as error instead of fixing up Date: Fri, 2 Feb 2024 11:59:07 -0800 Message-ID: <20240202195909.3458162-7-sboyd@kernel.org> X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog In-Reply-To: <20240202195909.3458162-1-sboyd@kernel.org> References: <20240202195909.3458162-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: 1789818662649520585 X-GMAIL-MSGID: 1789818662649520585 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;