Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3760269pxu; Mon, 30 Nov 2020 09:41:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMp4W3IXzhhpmZp3TciA6c3RgrZJod4oN3xxstuAAku1hZXvOT4uhPriL0dt0J34n6D/IR X-Received: by 2002:a17:906:604e:: with SMTP id p14mr15601619ejj.543.1606758073086; Mon, 30 Nov 2020 09:41:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606758073; cv=none; d=google.com; s=arc-20160816; b=bO/YHYgOlQKEvvRjXueuPK3u8r4Z4WJ5hKJGw2CZRNfsMaqfr59ZWHpAtXs8lzNxVs o0fEMKQrSnYYuWJHv6dLE952SGvEWOBa3T5eLcuD4Y0dF2/3DOzLSsV39z+BoHSULR7f PamOy7mFlHHcLwRDSG24rsiIxahaI7v/2Xj6f2LQOf1gF80wXK0O9VTvavJo2STpNTvk vE++l0vvy9IqJ5JKSON08iqW+llNKp0iBIMRhDqrFSLxncoWqBXYT8UvXAJ9TXnQohYo v3dlEFhbGdu6Vrwk0+vhRXUmoTEWWAy5wNiAc1nhJCi1og/303dd8qM1BcZl0QNKFx9v +h2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=pgx46SirvBI459qXHEcUdp6oHd5tNItn2RNM3kXbRws=; b=ek0PgASdpx366n12QORtdQeg9tzIapdQSy+QiUa6Cu8GIrBIuhg2QbCc8+FBBnwaM8 Da14CujlpSjaxsDeGW22HHVoPGFKxm3sIXPu5TYFvt05rNlOYSqnlnRl8evUgMpvp79v WCJhaVAj1Oskn5fEv2by0OfjZBEIL7IJPHlX2myss0qI6W09Bfa+qj0M9P85WqRHYGL9 2x1zw5nLhUrWUpuGKOjTQvLlQQJLlC3d3W+TRV/CG3h+8beoeMgMrxEZ9pmv2kU9/rt0 0H64a7o6uLUTFuCbXSNJYdC4opH9Q1QtQbnwBLMG12/2M/9USek1KDi5Q+bsw5Rk2w58 rrCQ== 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 k12si11464663eds.191.2020.11.30.09.40.48; Mon, 30 Nov 2020 09:41:13 -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 S1729367AbgK3RiH (ORCPT + 99 others); Mon, 30 Nov 2020 12:38:07 -0500 Received: from mga11.intel.com ([192.55.52.93]:41459 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729024AbgK3RiG (ORCPT ); Mon, 30 Nov 2020 12:38:06 -0500 IronPort-SDR: 3N4Qei0+GVdttbD0qsAwD9sdqU8JUMD/lbpF7cPm5fkjtEIdpuICTJL2szpibwzrr5yGdhqBzn 0HsgFB7NBSig== X-IronPort-AV: E=McAfee;i="6000,8403,9821"; a="169178662" X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="169178662" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 09:36:25 -0800 IronPort-SDR: S5RgzSOMvj9lyrQk4xZKqFlumiDi74YvoddutW32Dw2orZsbyJH1/OwL7wgjxINs7HXrlfp5wL W5MJwW1Mw6EQ== X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="334738822" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 09:36:18 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1kjn70-00B63R-Bw; Mon, 30 Nov 2020 19:37:18 +0200 Date: Mon, 30 Nov 2020 19:37:18 +0200 From: Andy Shevchenko To: Daniel Scally Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org, linux-media@vger.kernel.org, devel@acpica.org, rjw@rjwysocki.net, lenb@kernel.org, gregkh@linuxfoundation.org, mika.westerberg@linux.intel.com, linus.walleij@linaro.org, bgolaszewski@baylibre.com, wsa@kernel.org, yong.zhi@intel.com, sakari.ailus@linux.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, linux@rasmusvillemoes.dk, kieran.bingham+renesas@ideasonboard.com, jacopo+renesas@jmondi.org, laurent.pinchart+renesas@ideasonboard.com, jorhand@linux.microsoft.com, kitakar@gmail.com, heikki.krogerus@linux.intel.com Subject: Re: [PATCH 04/18] software_node: Enforce parent before child ordering of nodes array for software_node_register_nodes() Message-ID: <20201130173718.GP4077@smile.fi.intel.com> References: <20201130133129.1024662-1-djrscally@gmail.com> <20201130133129.1024662-5-djrscally@gmail.com> <20201130173530.GO4077@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201130173530.GO4077@smile.fi.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 30, 2020 at 07:35:30PM +0200, Andy Shevchenko wrote: > On Mon, Nov 30, 2020 at 01:31:15PM +0000, Daniel Scally wrote: ... > > for (i = 0; nodes[i].name; i++) { > > + if (nodes[i].parent) > > + if (!software_node_to_swnode(nodes[i].parent)) { > > + ret = -EINVAL; > > + goto err_unregister_nodes; > > + } > > + > > Besides that can we pack these conditionals together? > > if (nodes[i].parent && !software_node_to_swnode(nodes[i].parent)) { For being it shorter you may use temporary variable: software_node *parent; parent = nodes[i].parent; if (parent && !software_node_to_swnode(parent)) { -- With Best Regards, Andy Shevchenko