Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4015669pxu; Mon, 21 Dec 2020 01:54:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJySWLCFJsrwc35LcSG6IqVu457qpyffx4T2VAd2Dkyi3qEJ3xMyVrwB4dFn4yTtUfg80Ho9 X-Received: by 2002:aa7:c749:: with SMTP id c9mr15296398eds.3.1608544494010; Mon, 21 Dec 2020 01:54:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608544494; cv=none; d=google.com; s=arc-20160816; b=KLGyeq/MJFfsIf4erUT7BmgjDK5GKJ+lcFy2H8gEElT/iYX9s9o58+hwZb7m3WR8mV isVujhsLzGWJpkpDhGA+NDonTrHEGolzekOmaJf9f2+JoeICa22hPXaqyW/hA5ouuSIK 5LloV41EnsbextxwEXk+dYaa0s13WHvtbKMfnFDn8vgBdfbXcdGWIikOCaHw2KQILz/g +HYjcLY3WpHfQAZtfTY8zyWQ0GCWW0HWGdlTUzCHn8i3WXYMxyHA8oS/gC4PQXE2SPkG 204xo5+tuNSTwI4xlfE4G5cz9jHjH6AeJgkJ4gRGgF8ApuA2v8824TuxDV53/sPTDqDW aWTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=dm/rmuXTOOjuSTYujONvhjbqOXA7Pvtnuqp2Xe1R5b8=; b=JO1PD494yDmADH3X2fwgEM4Sx5egPGryDU0nb7mwuLnsbHA/efA2h4tcLfpzAVGxYP 2t6Kb3l4V07PXps6W3TPmyPFdBqQGqMiD2DZuDmeCmCz8ySl/MFBMtmGbGDO8wVc/vKJ tMas18uZtD5q41KmyoxvtDDFWCNVXcdCuwH/ePeJjtUgsH5728ksQE2tCmRs9Gn5c7Hs KbUnKHCaha5hHvjWPE0zMPBmtsTVgy7+7n1e8bOqFBwLC/jHbrjK2uKTts6jFhqhVkkH x5ZO68F/a13rqkGa9uAOJTLih4K1hutyqNrXorIRQjj0NJSLFWtPWGd9fE3LcvpY4kVU ALgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk28si9797353edb.336.2020.12.21.01.54.31; Mon, 21 Dec 2020 01:54:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727088AbgLUJuq (ORCPT + 99 others); Mon, 21 Dec 2020 04:50:46 -0500 Received: from mga18.intel.com ([134.134.136.126]:21973 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbgLUJup (ORCPT ); Mon, 21 Dec 2020 04:50:45 -0500 IronPort-SDR: yvFMMTOOcKZXZnAcNXukPlpCkIZ7/MbtBoQzL/YCyumqOTxPOI++zP+S6kf7ULR7CAMZvgxIEY HTL/cfbyZeMA== X-IronPort-AV: E=McAfee;i="6000,8403,9841"; a="163425485" X-IronPort-AV: E=Sophos;i="5.78,436,1599548400"; d="scan'208";a="163425485" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2020 01:21:25 -0800 IronPort-SDR: ZsYYsjfQymkNrlz2gNxFQTYaoGP4sN2o6dq4IWGgbSwH9hgigMuWqf0tuNueN1j9a1Z2fYAiOE A+WbzBokbxAA== X-IronPort-AV: E=Sophos;i="5.78,436,1599548400"; d="scan'208";a="372380899" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2020 01:21:18 -0800 Received: by paasikivi.fi.intel.com (Postfix, from userid 1000) id EF9F6205F7; Mon, 21 Dec 2020 11:21:16 +0200 (EET) Date: Mon, 21 Dec 2020 11:21:16 +0200 From: Sakari Ailus To: Daniel Scally Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-media@vger.kernel.org, devel@acpica.org, rjw@rjwysocki.net, lenb@kernel.org, gregkh@linuxfoundation.org, yong.zhi@intel.com, bingbu.cao@intel.com, tian.shu.qiu@intel.com, mchehab@kernel.org, robert.moore@intel.com, erik.kaneda@intel.com, pmladek@suse.com, rostedt@goodmis.org, sergey.senozhatsky@gmail.com, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk, laurent.pinchart+renesas@ideasonboard.com, jacopo+renesas@jmondi.org, kieran.bingham+renesas@ideasonboard.com, linus.walleij@linaro.org, heikki.krogerus@linux.intel.com, kitakar@gmail.com, jorhand@linux.microsoft.com, kernel test robot , Dan Carpenter , Laurent Pinchart Subject: Re: [PATCH v2 05/12] software_node: unregister software_nodes in reverse order Message-ID: <20201221092116.GG26370@paasikivi.fi.intel.com> References: <20201217234337.1983732-1-djrscally@gmail.com> <20201217234337.1983732-6-djrscally@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201217234337.1983732-6-djrscally@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, On Thu, Dec 17, 2020 at 11:43:30PM +0000, Daniel Scally wrote: > To maintain consistency with software_node_unregister_nodes(), reverse > the order in which the software_node_unregister_node_group() function > unregisters nodes. > > Reported-by: kernel test robot > Reported-by: Dan Carpenter > Reviewed-by: Laurent Pinchart > Suggested-by: Andy Shevchenko > Signed-off-by: Daniel Scally > --- > Changes in v2: > > - Initialised i properly > > drivers/base/swnode.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c > index cfd1faea48a7..2b90d380039b 100644 > --- a/drivers/base/swnode.c > +++ b/drivers/base/swnode.c > @@ -778,16 +778,22 @@ EXPORT_SYMBOL_GPL(software_node_register_node_group); > * software_node_unregister_node_group - Unregister a group of software nodes > * @node_group: NULL terminated array of software node pointers to be unregistered > * > - * Unregister multiple software nodes at once. > + * Unregister multiple software nodes at once. The array will be unwound in > + * reverse order (I.E. last entry first) and thus if any member of the array > + * has its .parent member set then they should appear later in the array such > + * that they are unregistered first. > */ > void software_node_unregister_node_group(const struct software_node **node_group) > { > - unsigned int i; > + unsigned int i = 0; > > if (!node_group) > return; > > - for (i = 0; node_group[i]; i++) > + while (node_group[i]->name) Why is this change made? node_group is a NULL-terminated array, and the above accesses the name pointer on each entry before checking the entry is non-NULL. Or do I miss something here? > + i++; > + > + while (i--) > software_node_unregister(node_group[i]); > } > EXPORT_SYMBOL_GPL(software_node_unregister_node_group); -- Regards, Sakari Ailus