diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2015-08-27 22:25:54 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-09-09 07:48:03 -0600 |
commit | e408c42189861b5ca18993e8fbb6975e67d4d442 (patch) | |
tree | 9f6f55b095b1b7a64ae92fe2964c2dc47be3af72 /net/eth.c | |
parent | 71d7971facdba763c220ca2cfdbd181e907eae89 (diff) | |
download | u-boot-imx-e408c42189861b5ca18993e8fbb6975e67d4d442.zip u-boot-imx-e408c42189861b5ca18993e8fbb6975e67d4d442.tar.gz u-boot-imx-e408c42189861b5ca18993e8fbb6975e67d4d442.tar.bz2 |
dm: eth: Correctly detect alias in eth_get_dev_by_name()
When given a device name string, we should test to see if it is
really an alias like "eth#".
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'net/eth.c')
-rw-r--r-- | net/eth.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -195,10 +195,11 @@ struct udevice *eth_get_dev_by_name(const char *devname) const char *startp = NULL; struct udevice *it; struct uclass *uc; + int len = strlen("eth"); /* Must be longer than 3 to be an alias */ - if (strlen(devname) > strlen("eth")) { - startp = devname + strlen("eth"); + if (!strncmp(devname, "eth", len) && strlen(devname) > len) { + startp = devname + len; seq = simple_strtoul(startp, &endp, 10); } |