Bugfix: Set the bit that marks a device number in use.

This would cause a panic when disconnecting the second serial device.

Submitted by:	Lucius Windschuh
This commit is contained in:
Nick Hibma 2010-11-07 15:36:07 +00:00
parent 12af6654a3
commit 96a6480a53

View File

@ -200,9 +200,12 @@ ucom_unit_alloc(void)
mtx_lock(&ucom_bitmap_mtx);
for (unit = 0; unit < UCOM_UNIT_MAX; unit++)
if ((ucom_bitmap[unit / 8] & (1 << (unit % 8))) == 0)
for (unit = 0; unit < UCOM_UNIT_MAX; unit++) {
if ((ucom_bitmap[unit / 8] & (1 << (unit % 8))) == 0) {
ucom_bitmap[unit / 8] |= (1 << (unit % 8));
break;
}
}
mtx_unlock(&ucom_bitmap_mtx);