aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2019-12-18 21:41:53 +0000
committerMark Johnston <markj@FreeBSD.org>2019-12-18 21:41:53 +0000
commit6074a3c0f469b748f050cffe6b73c6828e88e653 (patch)
treea8215c79f9fca6809586db020bdc81a035197d93
parent93065a5afdf7ffd315123a877467da4cbcae0d38 (diff)
downloadsrc-6074a3c0f469b748f050cffe6b73c6828e88e653.tar.gz
src-6074a3c0f469b748f050cffe6b73c6828e88e653.zip
vnic: Relax PHY node matching after r336281.
The phy name may apparently be followed by a number in some systems. Allow that. PR: 242654 Reported and tested by: Marcel <marcel@brickporch.com> MFC after: 3 days Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/head/; revision=355887
-rw-r--r--sys/dev/vnic/thunder_bgx_fdt.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/vnic/thunder_bgx_fdt.c b/sys/dev/vnic/thunder_bgx_fdt.c
index a295c18d73bd..37ebcad37b4d 100644
--- a/sys/dev/vnic/thunder_bgx_fdt.c
+++ b/sys/dev/vnic/thunder_bgx_fdt.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/bitset.h>
#include <sys/bitstring.h>
#include <sys/bus.h>
+#include <sys/ctype.h>
#include <sys/endian.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
@@ -151,6 +152,7 @@ bgx_fdt_phy_name_match(struct bgx *bgx, char *phy_name, ssize_t size)
{
const char *type;
ssize_t sz;
+ char last;
switch (bgx->qlm_mode) {
case QLM_MODE_SGMII:
@@ -193,10 +195,11 @@ bgx_fdt_phy_name_match(struct bgx *bgx, char *phy_name, ssize_t size)
if (sz > size)
return (FALSE);
- if (strncmp(phy_name, type, sz - 1) == 0 &&
- (phy_name[sz - 1] == '\0' || phy_name[sz - 1] == '@'))
- return (TRUE);
-
+ if (strncmp(phy_name, type, sz - 1) == 0) {
+ last = phy_name[sz - 1];
+ if (last == '\0' || last == '@' || isdigit(last))
+ return (TRUE);
+ }
return (FALSE);
}