And fixed it correctly.
This commit is contained in:
@@ -142,7 +142,7 @@ device_add_common(const device_t *d, const device_t *cd, void *p, void *params,
|
|||||||
void *priv = NULL;
|
void *priv = NULL;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
for (c = 0; c <= 256; c++) {
|
for (c = 0; c < 256; c++) {
|
||||||
if (!inst && (devices[c] == (device_t *) d)) {
|
if (!inst && (devices[c] == (device_t *) d)) {
|
||||||
device_log("DEVICE: device already exists!\n");
|
device_log("DEVICE: device already exists!\n");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@@ -150,8 +150,10 @@ device_add_common(const device_t *d, const device_t *cd, void *p, void *params,
|
|||||||
if (devices[c] == NULL)
|
if (devices[c] == NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (c >= DEVICE_MAX)
|
if ((c >= DEVICE_MAX) || (c >= 256)) {
|
||||||
fatal("DEVICE: too many devices\n");
|
fatal("DEVICE: too many devices\n");
|
||||||
|
retrn NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Do this so that a chained device_add will not identify the same ID
|
/* Do this so that a chained device_add will not identify the same ID
|
||||||
its master device is already trying to assign. */
|
its master device is already trying to assign. */
|
||||||
|
Reference in New Issue
Block a user