diff mbox series

net: xilinx: axi_emac: Fix endless loop when no PHYs are connected

Message ID 0db6169bb6d9e421bb4db9f5a6e740ef7700930f.1591261142.git.michal.simek@xilinx.com
State Accepted
Commit 945a55050dbd2e916724c2db0ac7eb6c3e29518e
Headers show
Series net: xilinx: axi_emac: Fix endless loop when no PHYs are connected | expand

Commit Message

Michal Simek June 4, 2020, 8:59 a.m. UTC
From: Patrick van Gelder <patrick.vangelder at nl.bosch.com>

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 at nl.bosch.com>
Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---

 drivers/net/xilinx_axi_emac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Michal Simek June 25, 2020, 8:06 a.m. UTC | #1
?t 4. 6. 2020 v 10:59 odes?latel Michal Simek <michal.simek at xilinx.com> napsal:
>
> From: Patrick van Gelder <patrick.vangelder at nl.bosch.com>
>
> 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 at nl.bosch.com>
> Signed-off-by: Michal Simek <michal.simek at xilinx.com>
> ---
>
>  drivers/net/xilinx_axi_emac.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
> index d0683db80d88..2cd559676846 100644
> --- a/drivers/net/xilinx_axi_emac.c
> +++ b/drivers/net/xilinx_axi_emac.c
> @@ -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;
> --
> 2.27.0
>

Applied.
M
diff mbox series

Patch

diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
index d0683db80d88..2cd559676846 100644
--- a/drivers/net/xilinx_axi_emac.c
+++ b/drivers/net/xilinx_axi_emac.c
@@ -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;