[prev in list] [next in list] [prev in thread] [next in thread]
List: freebsd-commits-all
Subject: svn commit: r344671 - head/sys/dev/cxgbe
From: John Baldwin <jhb () FreeBSD ! org>
Date: 2019-02-28 22:10:19
Message-ID: 201902282210.x1SMAJAt027498 () repo ! freebsd ! org
[Download RAW message or body]
Author: jhb
Date: Thu Feb 28 22:10:19 2019
New Revision: 344671
URL: https://svnweb.freebsd.org/changeset/base/344671
Log:
Don't assume all children of a nexus are ports.
Specifically, ccr(4) devices are also children of cxgbe nexus devices.
Rather than making assumptions about the child device's softc, walk
the list of ports from the nexus' softc to determine if a child is a
port in t4_child_location_str(). This fixes a panic when detaching a
ccr device.
Reviewed by: np
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D19399
Modified:
head/sys/dev/cxgbe/t4_main.c
Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c Thu Feb 28 22:00:36 2019 (r344670)
+++ head/sys/dev/cxgbe/t4_main.c Thu Feb 28 22:10:19 2019 (r344671)
@@ -1372,10 +1372,19 @@ done:
static int
t4_child_location_str(device_t bus, device_t dev, char *buf, size_t buflen)
{
+ struct adapter *sc;
struct port_info *pi;
+ int i;
- pi = device_get_softc(dev);
- snprintf(buf, buflen, "port=%d", pi->port_id);
+ sc = device_get_softc(bus);
+ buf[0] = '\0';
+ for_each_port(sc, i) {
+ pi = sc->port[i];
+ if (pi != NULL && pi->dev == dev) {
+ snprintf(buf, buflen, "port=%d", pi->port_id);
+ break;
+ }
+ }
return (0);
}
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic