]> www.infradead.org Git - linux-platform-drivers-x86.git/commitdiff
net: phy: mdio-bcm-unimac: Fix clock handling
authorAndre Przywara <andre.przywara@arm.com>
Tue, 24 Mar 2020 16:10:10 +0000 (16:10 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Mar 2020 23:45:32 +0000 (16:45 -0700)
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.

Fixes: b78ac6ecd1b6b ("net: phy: mdio-bcm-unimac: Allow configuring MDIO clock divider")
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/mdio-bcm-unimac.c

index 4a28fb29adaa8d5df841e61d3e86ab372fb7b267..fbd36891ee643cd0ae8cc53c44f2e940e6365c7c 100644 (file)
@@ -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)