Date: Mon, 16 May 2016 09:25:56 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299931 - head/sys/compat/linuxkpi/common/include/linux Message-ID: <201605160925.u4G9Pu8d016288@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605160925.u4G9Pu8d016288>