RE: [PATCH] phy: renesas: rcar-gen2: Fix double of_node_put on phy creation failure

Biju Das <[email protected]> Mon, 3 Aug 2026 13:21:29 +0000
Newsgroups org.infradead.lists.linux-phy,org.kernel.vger.linux-kernel,org.kernel.vger.linux-renesas-soc
Message-ID <TY3PR01MB11346A09428478C8C70BF50FE86D52@TY3PR01MB11346.jpnprd01.prod.outlook.com>
Hi Felix Gu,

Thanks for the patch.

> -----Original Message-----
> From: Felix Gu <[email protected]>
> Sent: 03 August 2026 13:43
> Subject: [PATCH] phy: renesas: rcar-gen2: Fix double of_node_put on phy creation failure
> 
> for_each_child_of_node_scoped() releases the node reference on scope exit, so the explicit
> of_node_put(np) in the devm_phy_create() error path drops it twice.
> 
> Drop the redundant of_node_put() and let the scoped cleanup handle it.
> 
> Fixes: b64b32791fb5 ("phy: renesas: rcar-gen2: Simplify with scoped for each OF child loop")
> Signed-off-by: Felix Gu <[email protected]>
> ---
>  drivers/phy/renesas/phy-rcar-gen2.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/phy/renesas/phy-rcar-gen2.c b/drivers/phy/renesas/phy-rcar-gen2.c
> index 6c671254c625..5a272e25e051 100644
> --- a/drivers/phy/renesas/phy-rcar-gen2.c
> +++ b/drivers/phy/renesas/phy-rcar-gen2.c
> @@ -405,7 +405,6 @@ static int rcar_gen2_phy_probe(struct platform_device *pdev)
>  						   data->gen2_phy_ops);
>  			if (IS_ERR(phy->phy)) {
>  				dev_err(dev, "Failed to create PHY\n");
> -				of_node_put(np);
>  				return PTR_ERR(phy->phy);

Now, can we use dev_err_probe() as it is probe function??

Cheers,
Biju

>  			}
>  			phy_set_drvdata(phy->phy, phy);
> 
> ---
> base-commit: 415606a7be939835db9b0d6b711887586646346d
> change-id: 20260803-rcar-gen2-140f014cd384
> 
> Best regards,
> --
> Felix Gu <[email protected]>
> 

-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy