summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r--sys/kern/subr_bus.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index ffade19..03abd48 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -376,8 +376,7 @@ devclass_alloc_unit(devclass_t dc, int *unitp)
device_t *newlist;
int newsize;
- newsize = (dc->maxunit ? 2 * dc->maxunit
- : MINALLOCSIZE / sizeof(device_t));
+ newsize = roundup((unit + 1), MINALLOCSIZE / sizeof(device_t));
newlist = malloc(sizeof(device_t) * newsize, M_BUS, M_NOWAIT);
if (!newlist)
return ENOMEM;
OpenPOWER on IntegriCloud