Re: [PATCH net-next v2 00/13] net: Simplified with scoped function
From: Jakub Kicinski <kuba@kernel.org>
Date: 2024-08-28 18:10:47
Also in:
linux-arm-kernel, linux-sunxi, lkml
From: Jakub Kicinski <kuba@kernel.org>
Date: 2024-08-28 18:10:47
Also in:
linux-arm-kernel, linux-sunxi, lkml
On Wed, 28 Aug 2024 16:45:32 +0200 Krzysztof Kozlowski wrote:
On 28/08/2024 16:32, Andrew Lunn wrote:quoted
On Wed, Aug 28, 2024 at 11:23:30AM +0800, Jinjie Ruan wrote:quoted
Simplify with scoped for each OF child loop and __free(), as well as dev_err_probe(). Changes in v2: - Subject prefix: next -> net-next. - Split __free() from scoped for each OF child loop clean. - Fix use of_node_put() instead of __free() for the 5th patch.I personally think all these __free() are ugly and magical. Can itIt is code readability so quite subjective. Jakub also rejected one of such __free() changes, so maybe all these cases here should be rejected?
Andrew's comments on refcounting on DT objects notwithstanding -- I do like the _scoped() iterator quite a bit, FWIW. I think it's one of the better uses of the auto-cleanup and local variable declarations. Direct uses of __free() are more questionable in my opinion. Using advanced constructs to build clean subsystem APIs is great, sprinkling unreadable constructs to save LoC is what C++ is for. (Lets see how many people this offends ;))