X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/24dde2b186e49d6d597d5a02e2b5f51e2147ca6e..f6c113a5fb217e7495b93053cf29fa6966923445:/lincan/src/main.c diff --git a/lincan/src/main.c b/lincan/src/main.c index fad1b6d..f69009b 100644 --- a/lincan/src/main.c +++ b/lincan/src/main.c @@ -74,7 +74,7 @@ #include "../include/can_iortl.h" #endif /*CAN_WITH_RTL*/ -#if defined(CONFIG_OC_LINCAN_CARD_ul_usb1) +#if defined(CONFIG_OC_LINCAN_CARD_usbcan) #include "../include/usbcan.h" #endif @@ -414,13 +414,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]); @@ -587,29 +591,15 @@ void cleanup_usbdev(struct candevice_t *dev) } #endif - for(i=0;ihostchip->hostdevice != dev) continue; - //canqueue_ends_done_chip(objects_p[i]->qends); - //can_checked_free(objects_p[i]->qends); - //can_checked_free(objects_p[i]); - objects_p[i]=NULL; - } - for(i=0;ihostdevice != dev) continue; - //can_checked_free(chips_p[i]->chipspecops); - //can_checked_free(chips_p[i]); chips_p[i]=NULL; } hardware_p->candevice[dev->candev_idx]=NULL; hardware_p->nr_boards--; - //kfree(hw[dev->candev_idx]); hw[dev->candev_idx]=NULL; - //can_checked_free(dev->hwspecops); - //can_checked_free(dev); candevice_done(dev); can_checked_free(dev);