svn commit: r299931 - head/sys/compat/linuxkpi/common/include/linux
Hans Petter Selasky
hselasky at FreeBSD.org
Mon May 16 09:25:57 UTC 2016
Author: hselasky
Date: Mon May 16 09:25:56 2016
New Revision: 299931
URL: https://svnweb.freebsd.org/changeset/base/299931
Log:
Don't dereference parent pointer when it is NULL.
MFC after: 1 week
Sponsored by: Mellanox Technologies
Modified:
head/sys/compat/linuxkpi/common/include/linux/device.h
Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/device.h Mon May 16 09:16:15 2016 (r299930)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h Mon May 16 09:25:56 2016 (r299931)
@@ -211,11 +211,11 @@ device_register(struct device *dev)
} else if (dev->parent == NULL) {
bsddev = devclass_get_device(dev->class->bsdclass, 0);
}
-
- if (bsddev == NULL)
+ if (bsddev == NULL && dev->parent != NULL) {
bsddev = device_add_child(dev->parent->bsddev,
dev->class->kobj.name, unit);
- if (bsddev) {
+ }
+ if (bsddev != NULL) {
if (dev->devt == 0)
dev->devt = makedev(0, device_get_unit(bsddev));
device_set_softc(bsddev, dev);
More information about the svn-src-all
mailing list