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

Andrew Lunn andrew at lunn.ch
Mon Nov 23 07:11:00 PST 2026


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



More information about the Linux-rockchip mailing list