Don't call malloc(9) to allocate zero bytes softc data for devices.
This commit is contained in:
parent
959b83b921
commit
00d70dec4e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=95316
@ -997,7 +997,7 @@ device_set_driver(device_t dev, driver_t *driver)
|
||||
dev->driver = driver;
|
||||
if (driver) {
|
||||
kobj_init((kobj_t) dev, (kobj_class_t) driver);
|
||||
if (!(dev->flags & DF_EXTERNALSOFTC)) {
|
||||
if (!(dev->flags & DF_EXTERNALSOFTC) && driver->size > 0) {
|
||||
dev->softc = malloc(driver->size, M_BUS,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (!dev->softc) {
|
||||
|
Loading…
Reference in New Issue
Block a user