From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) (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 776661CAB8 for ; Sat, 23 Nov 2024 19:30:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.82 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732390259; cv=none; b=TgSW0eX0PmtLroon98sx6XxHoVy+Q7vtg9wDEkA8gSfbgPYkGLBcmCcByLLyWTL9IMf+DPDY9h3piQxp8TeG46GeNhzhUR2P/NvdQcdpRWNTLKcwhPB1daF2Voef/qV2KkHK0MnI5mDo82Sm9Cf9O8TBvSIPCQJPLKVNlYYnSTE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732390259; c=relaxed/simple; bh=JC17rw+Hom8wSugYzI6RuOxpLgvkttMfUDPyeAFCHIE=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gqIWJsKvEkXteospH43eZ+sv4eyFV+TibdAps+Zj811LUxz2EeoqWq+wJvfzwZy6ud9e/5ggNiT8BHxnhN19UYEyig8ynW+b4/Frw0pSWydEiiCnyVrCglRs8rn7e9R6/wnb7d9JVnSrI6eGGLimSWPNDk01xRQOje/avlIYUjA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-25-143.elisa-laajakaista.fi [88.113.25.143]) by fgw20.mail.saunalahti.fi (Halon) with ESMTP id 470d06ed-a9d1-11ef-9b92-005056bd6ce9; Sat, 23 Nov 2024 21:29:39 +0200 (EET) From: Andy Shevchenko Date: Sat, 23 Nov 2024 21:29:37 +0200 To: Javier Carrasco Cc: Pavel Machek , Lee Jones , Matthias Brugger , AngeloGioacchino Del Regno , Gene Chen , Jacek Anaszewski , Bartosz Golaszewski , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Jonathan Cameron , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-sunxi@lists.linux.dev, stable@vger.kernel.org Subject: Re: [PATCH 00/18] leds: switch to device_for_each_child_node_scoped() Message-ID: References: <20240927-leds_device_for_each_child_node_scoped-v1-0-95c0614b38c8@gmail.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240927-leds_device_for_each_child_node_scoped-v1-0-95c0614b38c8@gmail.com> Fri, Sep 27, 2024 at 01:20:51AM +0200, Javier Carrasco kirjoitti: > This series switches from the device_for_each_child_node() macro to its > scoped variant, which in general makes the code more robust if new early > exits are added to the loops, because there is no need for explicit > calls to fwnode_handle_put(). Depending on the complexity of the loop > and its error handling, the code gets simplified and it gets easier to > follow. > > The non-scoped variant of the macro is error-prone, and it has been the > source of multiple bugs where the child node refcount was not > decremented accordingly in error paths within the loops. The first patch > of this series is a good example, which fixes that kind of bug that is > regularly found in node iterators. > > The uses of device_for_each_child_node() with no early exits have been > left untouched because their simpilicty justifies the non-scoped > variant. > > Note that the child node is now declared in the macro, and therefore the > explicit declaration is no longer required. > > The general functionality should not be affected by this modification. > If functional changes are found, please report them back as errors. Thank you for this series. It may now benefit from the next steps: 1) converting to return dev_err_probe() or dev_warn_probe() directly since the goto had been replaced by direct return, hence saving even more LoCs; 2) dropping or refactoring the complex conditions due to your nice series being applied. I'll comment individually on some to show what I meant by the above. -- With Best Regards, Andy Shevchenko