From owner-svn-src-stable@FreeBSD.ORG Sun Jan 29 12:58:07 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C45E1065675; Sun, 29 Jan 2012 12:58:07 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BD0C68FC1F; Sun, 29 Jan 2012 12:58:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0TCw6ut036229; Sun, 29 Jan 2012 12:58:06 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0TCw616036227; Sun, 29 Jan 2012 12:58:06 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201201291258.q0TCw616036227@svn.freebsd.org> From: Marius Strobl Date: Sun, 29 Jan 2012 12:58:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r230740 - stable/9/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 12:58:07 -0000 Author: marius Date: Sun Jan 29 12:58:06 2012 New Revision: 230740 URL: http://svn.freebsd.org/changeset/base/230740 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/9/sys/kern/subr_bus.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/kern/subr_bus.c ============================================================================== --- stable/9/sys/kern/subr_bus.c Sun Jan 29 12:56:21 2012 (r230739) +++ stable/9/sys/kern/subr_bus.c Sun Jan 29 12:58:06 2012 (r230740) @@ -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; }