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
for(j=0; j<candev->nr_all_chips; j++) {
if((chip=candev->chip[j])==NULL)
continue;
+
+ if(chip->chipspecops->attach_to_chip(chip)<0) {
+ CANMSG("Initial attach to the chip HW failed\n");
+ goto interrupt_error;
+ }
+
+ chip->flags |= CHIP_ATTACHED;
+
if(can_chip_setup_irq(chip)<0) {
- CANMSG("IRQ setup failed\n");
+ CANMSG("Error to setup chip IRQ\n");
goto interrupt_error;
}
}
-
+
if (candev->flags & CANDEV_PROGRAMMABLE_IRQ)
- if (candev->hwspecops->program_irq(candev))
+ if (candev->hwspecops->program_irq(candev)){
+ CANMSG("Error to program board interrupt\n");
goto interrupt_error;
+ }
}
#ifdef CONFIG_PROC_FS
#endif
interrupt_error: ;
- CANMSG("Error registering interrupt line.\n");
goto memory_error;
reset_error: ;
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)