svn commit: r228211 - head/sys/kern

Marius Strobl marius at FreeBSD.org
Fri Dec 2 22:03:28 UTC 2011


Author: marius
Date: Fri Dec  2 22:03:27 2011
New Revision: 228211
URL: http://svn.freebsd.org/changeset/base/228211

Log:
  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:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Fri Dec  2 21:45:46 2011	(r228210)
+++ head/sys/kern/subr_bus.c	Fri Dec  2 22:03:27 2011	(r228211)
@@ -2018,10 +2018,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;
 				}


More information about the svn-src-head mailing list