Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Feb 2015 18:59:53 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r278165 - head/sys/dev/fe
Message-ID:  <201502031859.t13Ixr4E012518@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Tue Feb  3 18:59:52 2015
New Revision: 278165
URL: https://svnweb.freebsd.org/changeset/base/278165

Log:
  Silence a coverity warning about ignoring a return value. We do, but
  we also know that it "can't fail" given the single-threaded nature of
  device enumeration. Go ahead and check it just in case, but add a
  comment.
  
  CID: 1009393
  Sponsored by: Netflix, Inc

Modified:
  head/sys/dev/fe/if_fe_isa.c

Modified: head/sys/dev/fe/if_fe_isa.c
==============================================================================
--- head/sys/dev/fe/if_fe_isa.c	Tue Feb  3 18:45:43 2015	(r278164)
+++ head/sys/dev/fe/if_fe_isa.c	Tue Feb  3 18:59:52 2015	(r278165)
@@ -133,10 +133,21 @@ static int
 fe_isa_attach(device_t dev)
 {
 	struct fe_softc *sc = device_get_softc(dev);
+	int error = 0;
 
-	if (sc->port_used)
-		fe_alloc_port(dev, sc->port_used);
-	fe_alloc_irq(dev, 0);
+	/*
+	 * Note: these routines aren't expected to fail since we also call
+	 * them in the probe routine.  But coverity complains, so we'll honor
+	 * that complaint since the intention here was never to ignore them..
+	 */
+	if (sc->port_used) {
+		error = fe_alloc_port(dev, sc->port_used);
+		if (error != 0)
+			return (error);
+	}
+	error = fe_alloc_irq(dev, 0);
+	if (error != 0)
+		return (error);
 
 	return fe_attach(dev);
 }



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