Re: [PATCH 4/8] net: bcmgenet: use platform_device_set_fwnode()

[email protected] Tue, 21 Jul 2026 09:26:03 +0000
Newsgroups dev.linux.lists.mfd,dev.linux.lists.imx
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The static function `bcmgenet_mii_of_find_mdio()` becomes completely unreferenced and triggers a compiler warning (`-Wunused-function`) when `CONFIG_OF` is disabled.
--

--- Patch [4]: [PATCH 4/8] net: bcmgenet: use platform_device_set_fwnode() ---
commit 91caf438269ceae68bf14d692c72b6702b3b3004
Author: Bartosz Golaszewski <[email protected]>

net: bcmgenet: use platform_device_set_fwnode()

This patch changes dynamically allocated platform devices to use the
higher-level platform_device_set_fwnode() rather than the OF-specific
platform_device_set_of_node().

> diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
> index 0f0dbabfaabbc..6f471723bd53f 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
[ ... ]
> @@ -492,7 +492,8 @@ static int bcmgenet_mii_register(struct bcmgenet_priv *priv)
>  	ppdev->dev.parent = &pdev->dev;
>  
>  	if (dn)
> -		platform_device_set_of_node(ppdev, bcmgenet_mii_of_find_mdio(priv));
> +		platform_device_set_fwnode(ppdev,
> +					   of_fwnode_handle(bcmgenet_mii_of_find_mdio(priv)));

[Severity: Low]
Will this cause a -Wunused-function warning for bcmgenet_mii_of_find_mdio()
when CONFIG_OF is disabled?

When CONFIG_OF is not set, include/linux/of.h defines of_fwnode_handle(node)
as just NULL. Because the macro discards its argument during preprocessing,
the call to bcmgenet_mii_of_find_mdio() is completely dropped, leaving the
static function unreferenced in this configuration.

Should bcmgenet_mii_of_find_mdio() be marked with __maybe_unused to prevent
build failures on setups using -Werror?

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/20260720-pdev-set-fwnode-instead-of-of-node-v1-0-2dee93f42c54@oss.qualcomm.com?part=4