Subject: Re: [PATCH net-next 1/8] net: mdio: realtek-rtl9300: Convert to fwnode API

From: Jakub Kicinski <[email-masked]>
Date: Tue, 2 Jun 2026 11:05:35 -0700

On Tue,  2 Jun 2026 07:26:33 +0200 Markus Stockhausen wrote:
> -		struct device_node *phy_dn __free(device_node) =
> -			of_parse_phandle(to_of_node(port), "phy-handle", 0);
> +		struct fwnode_handle *phy_fwnode __free(fwnode_handle) =
> +			fwnode_find_reference(port, "phy-handle", 0);
>  		/* skip ports without phys */
> -		if (!phy_dn)
> +		if (IS_ERR(phy_fwnode))
>  			continue;
>  
> -		mdio_dn = phy_dn->parent;
> +		struct fwnode_handle *bus_fwnode __free(fwnode_handle) =
> +			fwnode_get_parent(phy_fwnode);
> +		if (!bus_fwnode)
> +			continue;

Variable declarations mid functions are a no-go for netdev.

If you could please move away from using the __free() crap I'd
appreciate. Clearly missed it yesterday when applying these patches

Quoting documentation:

  Using device-managed and cleanup.h constructs
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  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.
  Similar guidance applies to declaring variables mid-function.
  
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#using-device-managed-and-cleanup-h-constructs