phy: Fix off-by-one error when parsing DT PHY bindings
authorMarek Vasut <marek.vasut+renesas@gmail.com>
Tue, 7 Aug 2018 10:24:35 +0000 (12:24 +0200)
committerMarek Vasut <marex@denx.de>
Tue, 14 Aug 2018 09:31:19 +0000 (11:31 +0200)
The code fails to copy the last PHY phandle argument, so it is
missing from the adjusted phandle args and the consumer cannot
use it to determine what the PHY should do.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
drivers/phy/phy-uclass.c

index 6162395..a0ac30a 100644 (file)
@@ -64,7 +64,7 @@ int generic_phy_get_by_index(struct udevice *dev, int index,
                        return ret;
 
                /* insert phy idx at first position into args array */
-               for (i = args.args_count; i > 1 ; i--)
+               for (i = args.args_count; i >= 1 ; i--)
                        args.args[i] = args.args[i - 1];
 
                args.args_count++;