When given a device name string, we should test if it contains "eth"
before we treat it as an alias.

With this commit, now we are really able to rotate between network
interfaces with driver model (previously it was broken).

Signed-off-by: Bin Meng <bmeng...@gmail.com>

---

 net/eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/eth.c b/net/eth.c
index 0b4b08a..fbf30b0 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -197,7 +197,7 @@ struct udevice *eth_get_dev_by_name(const char *devname)
        struct uclass *uc;
 
        /* Must be longer than 3 to be an alias */
-       if (strlen(devname) > strlen("eth")) {
+       if (strstr(devname, "eth") && strlen(devname) > strlen("eth")) {
                startp = devname + strlen("eth");
                seq = simple_strtoul(startp, &endp, 10);
        }
-- 
1.8.2.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to