1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

Don't dereference parent pointer when it is NULL.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2016-05-16 09:25:56 +00:00
parent 03219fba43
commit 88fa0d734c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=299931

View File

@ -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);