diff options
author | marius <marius@FreeBSD.org> | 2011-12-02 22:03:27 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2011-12-02 22:03:27 +0000 |
commit | c1dda66820c6e6eccf0746ee8557255b2cf4ab80 (patch) | |
tree | 1d807321eb570be84851b848ff17149b5cb33c1a | |
parent | 7b5b9bafe6519ca9217ccd8106f04b9234d77559 (diff) | |
download | FreeBSD-src-c1dda66820c6e6eccf0746ee8557255b2cf4ab80.zip FreeBSD-src-c1dda66820c6e6eccf0746ee8557255b2cf4ab80.tar.gz |
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
-rw-r--r-- | sys/kern/subr_bus.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 38e7167..a95bdb9 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -2018,10 +2018,11 @@ device_probe_child(device_t dev, device_t child) 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; } |