Skip to contentSkip to conversation

net: PHY: bcm-unimac: Fix clock handling

PATCH In review Andre Przywara 4 participants 5 messages Mar 24, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: PHY: bcm-unimac: Fix clock handling

The DT binding for this PHY describes an *optional* clock property. Due to a bug in the error handling logic, we are actually ignoring this clock *all* of the time so far.

Fix this by using devm_clk_get_optional() to handle this clock properly.

---
 drivers/net/phy/mdio-bcm-unimac.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/phy/mdio-bcm-unimac.c +2 -4
index 4a28fb29adaa..fbd36891ee64 100644
@@ -242,11 +242,9 @@ static int unimac_mdio_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	priv->clk = devm_clk_get(&pdev->dev, NULL);
-	if (PTR_ERR(priv->clk) == -EPROBE_DEFER)
+	priv->clk = devm_clk_get_optional(&pdev->dev, NULL);
+	if (IS_ERR(priv->clk))
 		return PTR_ERR(priv->clk);
-	else
-		priv->clk = NULL;
 
 	ret = clk_prepare_enable(priv->clk);
 	if (ret)
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Andre Przywara

The DT binding for this PHY describes an *optional* clock property. Due to a bug in the error handling logic, we are actually ignoring this clock *all* of the time so far.

Fix this by using devm_clk_get_optional() to handle this clock properly.

Hi Andre

Do you have a fixes: tag for this?

Andrew

#2 lore raw

On 24/03/2020 16:17, Andrew Lunn wrote:

Hi,

Quoted 5 lines · Andre Przywara
Quoted 4 lines

The DT binding for this PHY describes an *optional* clock property. Due to a bug in the error handling logic, we are actually ignoring this clock *all* of the time so far.

Quoted 7 lines
Quoted 3 lines

Fix this by using devm_clk_get_optional() to handle this clock properly.

Hi Andre

Do you have a fixes: tag for this?

Should be:

Fixes b78ac6ecd1b6b ("net: phy: mdio-bcm-unimac: Allow configuring MDIO

clock divider")

Quoted 1 line

Thanks for that!

Cheers,
Andre

#3 lore raw
Quoted 17 lines · André Przywara

On 24/03/2020 16:17, Andrew Lunn wrote:

Hi,

Quoted 5 lines · Andre Przywara
Quoted 4 lines

The DT binding for this PHY describes an *optional* clock property. Due to a bug in the error handling logic, we are actually ignoring this clock *all* of the time so far.

Quoted 7 lines
Quoted 3 lines

Fix this by using devm_clk_get_optional() to handle this clock properly.

Hi Andre

Do you have a fixes: tag for this?

Quoted 7 lines

Should be:

Fixes b78ac6ecd1b6b ("net: phy: mdio-bcm-unimac: Allow configuring MDIO

clock divider")

Quoted 1 line

Thanks for that!

And the subject should be:

net: phy: mdio-bcm-unimac: Fix clock handling

Signature · 1 line
Florian
maintainer
#4 lore raw
In reply to Andre Przywara

From: Andre Przywara <[email protected]>
Date: Tue, 24 Mar 2020 16:10:10 +0000

Quoted 7 lines

The DT binding for this PHY describes an *optional* clock property. Due to a bug in the error handling logic, we are actually ignoring this clock *all* of the time so far.

Fix this by using devm_clk_get_optional() to handle this clock properly.

Applied with Fixes tag added and Subject line corrected.

Thanks.