X-Git-Url: https://rtime.felk.cvut.cz/gitweb/can-usb1.git/blobdiff_plain/380d9d19869a224720d02404e0823e2cd370a33f..53637485d5dc14ac14527f25b658421ed9b29f7f:/lincan-0.3.3/src/usbcan.c diff --git a/lincan-0.3.3/src/usbcan.c b/lincan-0.3.3/src/usbcan.c index 1be7a90..7980cc3 100644 --- a/lincan-0.3.3/src/usbcan.c +++ b/lincan-0.3.3/src/usbcan.c @@ -47,6 +47,12 @@ int usbcan_request_io(struct candevice_t *candev) { struct usbcan_usb *dev = (struct usbcan_usb*)candev->sysdevptr.anydev; + if (!dev){ + CANMSG("Cannot register usbcan while usb device is not present.\n"); + CANMSG("Usbcan registers automatically on device insertion.\n"); + return -ENODEV; + } + /* start kernel thread */ dev->rcvthread.arg = dev; start_kthread(usbcan_read_kthread, &dev->rcvthread);