Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1669612ybg; Thu, 4 Jun 2020 16:11:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuQ9RQscChLVQI49bVs1cz5kyew+Nc9uvDnKLK7mq/d1CVuUK4eIsSXzVCJcURyWtGRuzg X-Received: by 2002:a50:8dc2:: with SMTP id s2mr6802515edh.318.1591312266605; Thu, 04 Jun 2020 16:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591312266; cv=none; d=google.com; s=arc-20160816; b=jfdjg2FLLob4L+NovbAIgqYhMH+NCmScgct+qC6wz/mwr77WuiRGUiW00kkwZyONgB fdslgHbMiQvSKOeDcInaqDemO4ZxcqPYuK7bSy6yuMI7kZZws6bG2Y59wO3e1ptGYQFU nvolVgW7kyIG9fxHRA+lm7n1v2J/srWCRvUpW2MkkM4NoLkny0K1YVWmM+yezURGmJ2p 6Q+b1EHQjD6K0eOT+A6LO/yntWRkHqhWKJeA6T0y1UdF8vjP8GqpsnlMpuW4VfQnOCR3 64hnX/crx0aE/ZunCVp9uGivuva79RYjfcYCjtuynbUCFXTm95T1VUnjYCL0D4bZOHMu vmwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature:dkim-filter; bh=Wgn0x3zC/o4zblELYidkRAENBz/ajl7eE6ze+n4i+58=; b=CgCNHqRrqhTKQ3PalWg3vGS6/n3v9HokFuFk7INLh1yXZ8zh2TeMEJ8BNpjqSJ1ixu 6ByahVnLahTPpGjLts07Ztuj+gvDA5oqJUhmU7/upsOKk3DvCVSf0MQ2cfZ8aKCl1a/1 hqtkDhl3KpppkkAgIbQ10I7Guzsqk2clSrCNDZ+AG2gho2M1dkI2o4IqcbPHFPCQ/ZAx D9OaK3KS3e8+JWB4kEl4Fj+S7vueDVzD6EDwuIl+n5kY9/wvrprNhb6NPYzOgextP4Xb HK4E9Si3G9H4H7rsr6T7A9cryL7RXIKRTwXUg249yG6v5uNK2cn9P/3XVyeu4el+Svav 7v/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=W6PfPVKV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si2388398ejy.5.2020.06.04.16.10.44; Thu, 04 Jun 2020 16:11:06 -0700 (PDT) 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; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=W6PfPVKV; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726600AbgFDU5I (ORCPT + 99 others); Thu, 4 Jun 2020 16:57:08 -0400 Received: from linux.microsoft.com ([13.77.154.182]:36334 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725952AbgFDU5H (ORCPT ); Thu, 4 Jun 2020 16:57:07 -0400 Received: from [192.168.1.14] (unknown [76.104.235.235]) by linux.microsoft.com (Postfix) with ESMTPSA id E175120B7185; Thu, 4 Jun 2020 13:57:06 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E175120B7185 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1591304227; bh=Wgn0x3zC/o4zblELYidkRAENBz/ajl7eE6ze+n4i+58=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=W6PfPVKVNfCF7A/5tLhh6/6oaQ5Gkzp+2zaVW0Zd97RGfMwrn17II0v9RsMl/c+jF HLz+4P4yZA/R4fsJ9NgT9qcWlkj9hUgVw5YX19L882wIy6Ai7jHfePemA649MXr1OZ n6AFDnoCccmf7XL3+Ee26Toxm5c3p5hQJo9ZrYmc= Subject: Re: [PATCH] software node: recursively unregister child swnodes To: Greg Kroah-Hartman Cc: Heikki Krogerus , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-next@vger.kernel.org References: <20200604193623.16946-1-jorhand@linux.microsoft.com> <20200604201523.GA1308830@kroah.com> From: Jordan Hand Message-ID: Date: Thu, 4 Jun 2020 13:57:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200604201523.GA1308830@kroah.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/4/20 1:15 PM, Greg Kroah-Hartman wrote: > On Thu, Jun 04, 2020 at 12:36:23PM -0700, jorhand@linux.microsoft.com wrote: >> From: Jordan Hand >> >> If a child swnode is unregistered after it's parent, it can lead to >> undefined behavior. > > Crashing the system is not really "undefined" :) Fair point :) > >> When a swnode is unregistered, recursively free it's children to avoid >> this condition. > > Are you sure? Why would you be unregistering a child after it's parent? > Why not just do not do that? > The main motivation for doing this was to support `software_node_unregister_nodes` so that the passed list of nodes does not need to be ordered in any particular way. I suppose another way to do this would be to add a new function `fwnode_remove_software_node_recursive` and just call that from `software_node_unregister_nodes`. That said, I suppose just ordering the nodes so that children come before parents would also be fine. My thinking was just that accepting any node ordering is simpler. Thanks, Jordan