Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jan 2012 12:58:07 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r230741 - stable/8/sys/kern
Message-ID:  <201201291258.q0TCw7rH036257@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sun Jan 29 12:58:07 2012
New Revision: 230741
URL: http://svn.freebsd.org/changeset/base/230741

Log:
  MFC: r228211
  
  It doesn't make much sense to check whether child is NULL after already
  having dereferenced it. We either should generally check the device_t's
  supplied to bus functions before using them (which we seem to virtually
  never do) or just assume that they are not NULL.
  While at it make this code fit 78 columns.
  
  Found with:	Coverity Prevent(tm)
  CID:		4230

Modified:
  stable/8/sys/kern/subr_bus.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/kern/subr_bus.c
==============================================================================
--- stable/8/sys/kern/subr_bus.c	Sun Jan 29 12:58:06 2012	(r230740)
+++ stable/8/sys/kern/subr_bus.c	Sun Jan 29 12:58:07 2012	(r230741)
@@ -2021,10 +2021,11 @@ device_probe_child(device_t dev, device_
 			else if (result != 0)
 				continue;
 			if (!hasclass) {
-				if (device_set_devclass(child, dl->driver->name)) {
-					printf("driver bug: Unable to set devclass (devname: %s)\n",
-					    (child ? device_get_name(child) :
-						"no device"));
+				if (device_set_devclass(child,
+				    dl->driver->name) != 0) {
+					printf("driver bug: Unable to set "
+					    "devclass (devname: %s)\n",
+					    device_get_name(child));
 					(void)device_set_driver(child, NULL);
 					continue;
 				}



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