net: xilinx: axi_emac: Fix endless loop when no PHYs are connected
authorPatrick van Gelder <patrick.vangelder@nl.bosch.com>
Wed, 3 Jun 2020 12:18:04 +0000 (14:18 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 24 Jun 2020 11:11:08 +0000 (13:11 +0200)
The index used to iterate over the possible PHYs in axiemac_phy_init was an
unsigned int and decremented. Therefor it was always >= 0 and never exited
the loop.

Signed-off-by: Patrick van Gelder <patrick.vangelder@nl.bosch.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/net/xilinx_axi_emac.c

index d0683db80d88413ea95c765a9fb8b3fe613edb76..2cd55967684683648073382e1e2417b2d5143dd3 100644 (file)
@@ -244,7 +244,8 @@ static u32 phywrite(struct axidma_priv *priv, u32 phyaddress, u32 registernum,
 static int axiemac_phy_init(struct udevice *dev)
 {
        u16 phyreg;
-       u32 i, ret;
+       int i;
+       u32 ret;
        struct axidma_priv *priv = dev_get_priv(dev);
        struct axi_regs *regs = priv->iobase;
        struct phy_device *phydev;