]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/usbcan.c
Minor fixes
[lincan.git] / lincan / src / usbcan.c
index a18f8621cda002f65ace1943d966577e9c257cef..1be7a9031225a224ae23175607bde197d09156b0 100644 (file)
@@ -177,7 +177,7 @@ int usbcan_register(struct hwspecops_t *hwspecops)
        return 0;
 }
 
-static int sja1000_report_error_limit_counter;
+// static int sja1000_report_error_limit_counter;
 
 static void sja1000_report_error(struct canchip_t *chip,
                                unsigned sr, unsigned ir, unsigned ecc)
@@ -1041,7 +1041,7 @@ void usbcan_read_kthread(kthread_t *kthread)
 
                if (test_bit(USBCAN_ERROR,&dev->flags)){
                        CANMSG("URB error %d\n",retval);
-                       break;
+                       clear_bit(USBCAN_ERROR,&dev->flags);
                }
 
                { /* Normal work to do */
@@ -1098,6 +1098,7 @@ static int usbcan_probe(struct usb_interface *interface, const struct usb_device
                err("Out of memory");
                goto error;
        }
+       memset(dev, 0, sizeof(struct usbcan_usb));
 
        sema_init(&dev->limit_sem, WRITES_IN_FLIGHT);
        spin_lock_init(&dev->err_lock);
@@ -1188,6 +1189,8 @@ static void usbcan_disconnect(struct usb_interface *interface)
        int minor = interface->minor;
 
        dev = usb_get_intfdata(interface);
+       if (!dev)
+               return;
        usb_set_intfdata(interface, NULL);
 
        /* prevent more I/O from starting */