* [PATCH v2 1/3] phy: renesas: rcar-gen2: Fix double of_node_put on phy creation failure
2026-08-04 15:24 [PATCH v2 0/3] phy: renesas: rcar-gen2: three cleanups Felix Gu
@ 2026-08-04 15:24 ` Felix Gu
2026-08-04 15:24 ` [PATCH v2 2/3] phy: renesas: rcar-gen2: Return -EINVAL for out-of-range channel reg Felix Gu
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Felix Gu @ 2026-08-04 15:24 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Geert Uytterhoeven, Magnus Damm,
Krzysztof Kozlowski, Kishon Vijay Abraham I, Sergei Shtylyov
Cc: linux-phy, linux-renesas-soc, linux-kernel, Felix Gu
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")
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
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);
}
phy_set_drvdata(phy->phy, phy);
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 2/3] phy: renesas: rcar-gen2: Return -EINVAL for out-of-range channel reg
2026-08-04 15:24 [PATCH v2 0/3] phy: renesas: rcar-gen2: three cleanups Felix Gu
2026-08-04 15:24 ` [PATCH v2 1/3] phy: renesas: rcar-gen2: Fix double of_node_put on phy creation failure Felix Gu
@ 2026-08-04 15:24 ` Felix Gu
2026-08-04 15:24 ` [PATCH v2 3/3] phy: renesas: rcar-gen2: Use dev_err_probe() in probe Felix Gu
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Felix Gu @ 2026-08-04 15:24 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Geert Uytterhoeven, Magnus Damm,
Krzysztof Kozlowski, Kishon Vijay Abraham I, Sergei Shtylyov
Cc: linux-phy, linux-renesas-soc, linux-kernel, Felix Gu
When of_property_read_u32() succeeds but channel_num exceeds
data->num_channels, rcar_gen2_phy_probe() returns error which is 0,
so probe reports success even though no PHY provider is registered.
Return -EINVAL in that case.
Fixes: 1233f59f745b ("phy: Renesas R-Car Gen2 PHY driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/phy/renesas/phy-rcar-gen2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/phy/renesas/phy-rcar-gen2.c b/drivers/phy/renesas/phy-rcar-gen2.c
index 5a272e25e051..b18727ed41a1 100644
--- a/drivers/phy/renesas/phy-rcar-gen2.c
+++ b/drivers/phy/renesas/phy-rcar-gen2.c
@@ -390,7 +390,7 @@ static int rcar_gen2_phy_probe(struct platform_device *pdev)
error = of_property_read_u32(np, "reg", &channel_num);
if (error || channel_num >= data->num_channels) {
dev_err(dev, "Invalid \"reg\" property\n");
- return error;
+ return error ?: -EINVAL;
}
channel->select_mask = select_mask[channel_num];
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 3/3] phy: renesas: rcar-gen2: Use dev_err_probe() in probe
2026-08-04 15:24 [PATCH v2 0/3] phy: renesas: rcar-gen2: three cleanups Felix Gu
2026-08-04 15:24 ` [PATCH v2 1/3] phy: renesas: rcar-gen2: Fix double of_node_put on phy creation failure Felix Gu
2026-08-04 15:24 ` [PATCH v2 2/3] phy: renesas: rcar-gen2: Return -EINVAL for out-of-range channel reg Felix Gu
@ 2026-08-04 15:24 ` Felix Gu
2026-09-26 14:50 ` [PATCH v2 0/3] phy: renesas: rcar-gen2: three cleanups Manivannan Sadhasivam
2026-10-03 8:35 ` Vinod Koul
4 siblings, 0 replies; 6+ messages in thread
From: Felix Gu @ 2026-08-04 15:24 UTC (permalink / raw)
To: Vinod Koul, Neil Armstrong, Geert Uytterhoeven, Magnus Damm,
Krzysztof Kozlowski, Kishon Vijay Abraham I, Sergei Shtylyov
Cc: linux-phy, linux-renesas-soc, linux-kernel, Felix Gu
Convert the error paths in rcar_gen2_phy_probe() to dev_err_probe().
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/phy/renesas/phy-rcar-gen2.c | 35 ++++++++++++++---------------------
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/drivers/phy/renesas/phy-rcar-gen2.c b/drivers/phy/renesas/phy-rcar-gen2.c
index b18727ed41a1..581f6768e2bb 100644
--- a/drivers/phy/renesas/phy-rcar-gen2.c
+++ b/drivers/phy/renesas/phy-rcar-gen2.c
@@ -342,17 +342,13 @@ static int rcar_gen2_phy_probe(struct platform_device *pdev)
const struct rcar_gen2_phy_data *data;
int i = 0;
- if (!dev->of_node) {
- dev_err(dev,
- "This driver is required to be instantiated from device tree\n");
- return -EINVAL;
- }
+ if (!dev->of_node)
+ return dev_err_probe(dev, -EINVAL,
+ "This driver is required to be instantiated from device tree\n");
clk = devm_clk_get(dev, "usbhs");
- if (IS_ERR(clk)) {
- dev_err(dev, "Can't get USBHS clock\n");
- return PTR_ERR(clk);
- }
+ if (IS_ERR(clk))
+ return dev_err_probe(dev, PTR_ERR(clk), "Can't get USBHS clock\n");
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
@@ -388,10 +384,9 @@ static int rcar_gen2_phy_probe(struct platform_device *pdev)
channel->selected_phy = -1;
error = of_property_read_u32(np, "reg", &channel_num);
- if (error || channel_num >= data->num_channels) {
- dev_err(dev, "Invalid \"reg\" property\n");
- return error ?: -EINVAL;
- }
+ if (error || channel_num >= data->num_channels)
+ return dev_err_probe(dev, error ?: -EINVAL,
+ "Invalid \"reg\" property\n");
channel->select_mask = select_mask[channel_num];
for (n = 0; n < PHYS_PER_CHANNEL; n++) {
@@ -403,10 +398,9 @@ static int rcar_gen2_phy_probe(struct platform_device *pdev)
phy->phy = devm_phy_create(dev, NULL,
data->gen2_phy_ops);
- if (IS_ERR(phy->phy)) {
- dev_err(dev, "Failed to create PHY\n");
- return PTR_ERR(phy->phy);
- }
+ if (IS_ERR(phy->phy))
+ return dev_err_probe(dev, PTR_ERR(phy->phy),
+ "Failed to create PHY\n");
phy_set_drvdata(phy->phy, phy);
}
@@ -414,10 +408,9 @@ static int rcar_gen2_phy_probe(struct platform_device *pdev)
}
provider = devm_of_phy_provider_register(dev, rcar_gen2_phy_xlate);
- if (IS_ERR(provider)) {
- dev_err(dev, "Failed to register PHY provider\n");
- return PTR_ERR(provider);
- }
+ if (IS_ERR(provider))
+ return dev_err_probe(dev, PTR_ERR(provider),
+ "Failed to register PHY provider\n");
dev_set_drvdata(dev, drv);
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2 0/3] phy: renesas: rcar-gen2: three cleanups
2026-08-04 15:24 [PATCH v2 0/3] phy: renesas: rcar-gen2: three cleanups Felix Gu
` (2 preceding siblings ...)
2026-08-04 15:24 ` [PATCH v2 3/3] phy: renesas: rcar-gen2: Use dev_err_probe() in probe Felix Gu
@ 2026-09-26 14:50 ` Manivannan Sadhasivam
2026-10-03 8:35 ` Vinod Koul
4 siblings, 0 replies; 6+ messages in thread
From: Manivannan Sadhasivam @ 2026-09-26 14:50 UTC (permalink / raw)
To: Felix Gu
Cc: Vinod Koul, Neil Armstrong, Geert Uytterhoeven, Magnus Damm,
Krzysztof Kozlowski, Kishon Vijay Abraham I, Sergei Shtylyov,
linux-phy, linux-renesas-soc, linux-kernel
On Tue, Aug 04, 2026 at 11:24:16PM +0800, Felix Gu wrote:
Please add description to the cover letter to summarise what the series does.
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
- Mani
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2 0/3] phy: renesas: rcar-gen2: three cleanups
2026-08-04 15:24 [PATCH v2 0/3] phy: renesas: rcar-gen2: three cleanups Felix Gu
` (3 preceding siblings ...)
2026-09-26 14:50 ` [PATCH v2 0/3] phy: renesas: rcar-gen2: three cleanups Manivannan Sadhasivam
@ 2026-10-03 8:35 ` Vinod Koul
4 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2026-10-03 8:35 UTC (permalink / raw)
To: Felix Gu
Cc: Neil Armstrong, Geert Uytterhoeven, Magnus Damm,
Krzysztof Kozlowski, Kishon Vijay Abraham I, Sergei Shtylyov,
linux-phy, linux-renesas-soc, linux-kernel
On 04-08-26, 23:24, Felix Gu wrote:
Please describe the changes and motivation in cover. Also this doesnt
apply for me, pls rebase
--
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread