summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormelifaro <melifaro@FreeBSD.org>2014-09-13 16:04:55 +0000
committermelifaro <melifaro@FreeBSD.org>2014-09-13 16:04:55 +0000
commitcca53e2bbcbf76b919d889efbeb8f2aa1f73980a (patch)
treee252cdf5ec68b7d418656a2f55995ccdf36570ea
parent0a46d9d7d592cf517c516fad4b2df10863ceeb83 (diff)
downloadFreeBSD-src-cca53e2bbcbf76b919d889efbeb8f2aa1f73980a.zip
FreeBSD-src-cca53e2bbcbf76b919d889efbeb8f2aa1f73980a.tar.gz
Do not try to read i2c info when no transceiver is present.
MFC with: r270064 Sponsored by: Yandex LLC
-rw-r--r--sbin/ifconfig/sfp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/ifconfig/sfp.c b/sbin/ifconfig/sfp.c
index 2e8039d..abe71d6 100644
--- a/sbin/ifconfig/sfp.c
+++ b/sbin/ifconfig/sfp.c
@@ -764,11 +764,13 @@ sfp_status(int s, struct ifreq *ifr, int verbose)
/*
* Try to read byte 0 from i2c:
* Both SFF-8472 and SFF-8436 use it as
- * 'identification byte'
+ * 'identification byte'.
+ * Stop reading status on zero as value -
+ * this might happen in case of empty transceiver slot.
*/
id_byte = 0;
ii.f(&ii, SFF_8472_BASE, SFF_8472_ID, 1, (caddr_t)&id_byte);
- if (ii.error != 0)
+ if (ii.error != 0 || id_byte == 0)
return;
switch (id_byte) {
OpenPOWER on IntegriCloud