Ensure free of checked alloc memory in the case that module_init fails
authorppisa <ppisa>
Thu, 2 Jun 2005 00:19:50 +0000 (00:19 +0000)
committerppisa <ppisa>
Thu, 2 Jun 2005 00:19:50 +0000 (00:19 +0000)
and unused Unican function deleted.

lincan/src/main.c
lincan/src/unican.c

index bb6abbf..60eb6e6 100644 (file)
@@ -195,7 +195,7 @@ int init_module(void)
        res=register_chrdev(major,DEVICE_NAME, &can_fops);
        if (res<0) {
                CANMSG("Error registering driver.\n");
-               return -ENODEV;
+               goto register_error;
        }
 
        #ifdef CAN_WITH_RTL
@@ -300,8 +300,12 @@ int init_module(void)
                        CANMSG("Error unloading CAN driver, error: %d\n",res);
                else
                        CANMSG("No CAN devices or driver setup error.\n");
-               return -ENODEV;
 
+       register_error:
+               if ( can_del_mem_list() ) 
+                       CANMSG("Error deallocating memory\n");
+
+               return -ENODEV;
 }
 
 void cleanup_module(void)
index f72bacc..df556d6 100644 (file)
@@ -29,18 +29,6 @@ static void unican_delay(long msdelay)
 
 }
 
-
-long unican_bus_latency(struct msgobj_t *obj)
-{
-       long latency;
-       latency=obj->hostchip->baudrate;
-       if(latency){
-               latency=(long)HZ*1000/latency;
-       }
-       return latency;
-}
-
-
 /* * * unican Chip Functionality * * */
 
 int unican_enable_configuration(struct canchip_t *chip)