X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/a8ff8ecbfa9fa4f402e763cd30cf3bb6c385e65f..50c42bb67d8c58c507a9c4a58e50c6879f6711a3:/lincan/src/main.c diff --git a/lincan/src/main.c b/lincan/src/main.c index dd2319a..f66a288 100644 --- a/lincan/src/main.c +++ b/lincan/src/main.c @@ -418,13 +418,17 @@ int init_module(void) struct candevice_t* register_usbdev(const char *hwname,void *anydev){ - int i=0, j, board; + int i=0, j, board=0; struct candevice_t *candev; struct canchip_t *chip; struct boardtype_t *brp; while ( (hw[board] != NULL) && (board < MAX_HW_CARDS) ) board++; + if (board>=MAX_HW_CARDS){ + CANMSG("Maximum number of devices has been reached, no space for new device"); + return NULL; + } brp = boardtype_find(hwname); if(!brp) { CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",hw[board]);