Re: [PATCH net-next] net: pcs: xpcs-rk: use cleanup.h for platform_device reference

Coia Prant coiaprant at gmail.com
Mon Nov 23 07:15:15 PST 2026


On November 23, 2026 11:11:00 PM GMT+08:00, Andrew Lunn <andrew at lunn.ch> wrote:
>On Mon, Nov 23, 2026 at 08:30:53PM +0800, Coia Prant wrote:
>> Use the __free(platform_device_put) cleanup action to manage the
>> platform_device reference obtained from of_find_device_by_node().
>> 
>> This removes the need for explicit put_device() calls on every failure
>> path and at the end of the successful path, simplifying the function
>> and reducing the chance of reference leaks or double puts.
>> 
>> Signed-off-by: Coia Prant <coiaprant at gmail.com>
>
>https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
>
>Low level cleanup constructs (such as __free()) can be used when
>building APIs and helpers, especially scoped iterators. However,
>direct use of __free() within networking core and drivers is
>discouraged.
>
>    Andrew
>
>---
>pw-bot: cr

Understood, thanks for the pointer. I have no plan to change this and will
keep the explicit put_device() calls as-is. Dropping this patch.

- Coia



More information about the Linux-rockchip mailing list