From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EADC8C433EF for ; Tue, 28 Jun 2022 14:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346877AbiF1OhH (ORCPT ); Tue, 28 Jun 2022 10:37:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346842AbiF1OhF (ORCPT ); Tue, 28 Jun 2022 10:37:05 -0400 Received: from mail-il1-f176.google.com (mail-il1-f176.google.com [209.85.166.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F15CC2C647; Tue, 28 Jun 2022 07:37:03 -0700 (PDT) Received: by mail-il1-f176.google.com with SMTP id i17so8255579ils.12; Tue, 28 Jun 2022 07:37:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=A1IJcZJ/hlL884WwHr614CqNiCZ/WVZ7mtlSDIsFU1s=; b=iObil4jRBsYFr5DgetYsegl9YtOUJRdmVQE6lDRHKX9g00Mwgyg1cZzPg4G9/63J38 xWkb8rYopUcqETdB773LPVH1CPp7vDfZnh8/OVsArCwmXOAY/eps5I9h2EoQR3dElm/p uupTlL8gHQe0WYpfQYxBl/nUf0RhSNKnCOS1B4OnQfUl65ZHPLQMt43pNNlaBYzQv1pP z+oJnbEMz3i/NPLtcpiAUQJ62SW+KwFYWU8PyiD008V5BvOxBDHDBTBwm9q8hiTgAP+y F5TwuTGTfr/UAVWxFDGrwsSMP+dDakTO+56ehzP/FDAlA4ZuIEUN1SytHnCEZvyxyshD 0qjg== X-Gm-Message-State: AJIora+2ozQj7iNp4geFz4Xrrrp40w/sjLQqKSpIBdqDrbQCnVQZp8Yw SxpL6KPJTaQLVLKaF9R1fw== X-Google-Smtp-Source: AGRyM1vWantaaEVLWxSMmc91idW90bcTQDTqEJa+Xl/smZ1uzAXfk0cGXzKcb6Tr53u0DPCJ/lazrw== X-Received: by 2002:a05:6e02:16cf:b0:2d1:a511:499b with SMTP id 15-20020a056e0216cf00b002d1a511499bmr11115588ilx.77.1656427023250; Tue, 28 Jun 2022 07:37:03 -0700 (PDT) Received: from robh.at.kernel.org ([64.188.179.253]) by smtp.gmail.com with ESMTPSA id u13-20020a5d818d000000b0067513ad66c3sm5448207ion.41.2022.06.28.07.37.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 07:37:02 -0700 (PDT) Received: (nullmailer pid 425510 invoked by uid 1000); Tue, 28 Jun 2022 14:36:59 -0000 Date: Tue, 28 Jun 2022 08:36:59 -0600 From: Rob Herring To: frowand.list@gmail.com Cc: =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lizhi Hou , Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni Subject: Re: [PATCH 2/2] of: unittest: treat missing of_root as error instead of fixing up Message-ID: <20220628143659.GA424332-robh@kernel.org> References: <20220624034327.2542112-1-frowand.list@gmail.com> <20220624034327.2542112-3-frowand.list@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220624034327.2542112-3-frowand.list@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 23, 2022 at 10:43:27PM -0500, frowand.list@gmail.com wrote: > From: Frank Rowand > > setup_of() now ensures that of_root node is populated with the > root of a default 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. What happened with the formatting here? > > Signed-off-by: Frank Rowand > --- > drivers/of/unittest.c | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-) > > diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c > index 7f6bba18c515..9d106998c1f2 100644 > --- a/drivers/of/unittest.c > +++ b/drivers/of/unittest.c > @@ -1469,20 +1469,16 @@ static int __init unittest_data_add(void) > return -EINVAL; > } > > - 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; > - } > - > EXPECT_BEGIN(KERN_INFO, > "Duplicate name in testcase-data, renamed to \"duplicate-name#1\""); > > /* attach the sub-tree to live tree */ > + if (!of_root) { > + pr_warn("%s: no live tree to attach sub-tree\n", __func__); > + kfree(unittest_data); > + return -ENODEV; > + } > + > np = unittest_data_node->child; > while (np) { > struct device_node *next = np->sibling; > -- > Frank Rowand > >