Don't call malloc(9) to allocate zero bytes softc data for devices.

This commit is contained in:
Poul-Henning Kamp 2002-04-23 15:48:23 +00:00
parent 959b83b921
commit 00d70dec4e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=95316

View File

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