From c9f75ae1adefa54612bef6203f2459e337076572 Mon Sep 17 00:00:00 2001 From: Jan Kriz Date: Thu, 24 Jul 2008 11:44:01 +0200 Subject: [PATCH] Added check of usbcan device presence on registration --- lincan/src/usbcan.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lincan/src/usbcan.c b/lincan/src/usbcan.c index 1be7a90..7980cc3 100644 --- a/lincan/src/usbcan.c +++ b/lincan/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); -- 2.39.2