Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Sep 2014 16:04:56 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r271524 - head/sbin/ifconfig
Message-ID:  <201409131604.s8DG4u9D099113@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: melifaro
Date: Sat Sep 13 16:04:55 2014
New Revision: 271524
URL: http://svnweb.freebsd.org/changeset/base/271524

Log:
  Do not try to read i2c info when no transceiver is present.
  
  MFC with:	r270064
  Sponsored by:	Yandex LLC

Modified:
  head/sbin/ifconfig/sfp.c

Modified: head/sbin/ifconfig/sfp.c
==============================================================================
--- head/sbin/ifconfig/sfp.c	Sat Sep 13 16:02:43 2014	(r271523)
+++ head/sbin/ifconfig/sfp.c	Sat Sep 13 16:04:55 2014	(r271524)
@@ -764,11 +764,13 @@ sfp_status(int s, struct ifreq *ifr, int
 	/*
 	 * 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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409131604.s8DG4u9D099113>