<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">I think usbvision_probe is called because of the dummy device code. We should probably rethink the dummy device.<br><br><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Thierry MERLE <thierry.merle@free.fr><br>To: Mauro Carvalho Chehab <mchehab@infradead.org><br>Cc: Dwaine Garden <dwainegarden@rogers.com>; Linux and Kernel Video <video4linux-list@redhat.com>; Linux DVB <linux-dvb@linuxtv.org><br>Sent: Saturday, April 14, 2007 3:08:01 PM<br>Subject: Re: [Patch] USBVision - Fix NT1005 Bridge detection<br><br><div><br>Hi Mauro,<br><br>Mauro Carvalho Chehab a écrit :<br>> Hi Thierry,<br>><br>> <br>>> I
am currently debugging the Trent's patch that makes a kernel oops and <br>>> I don't know why.<br>>> The usbvision_probe is called event if the device is not plugged, and <br>>> the kernel oops occurs on this piece of code:<br>>> model = devid->driver_info;<br>>> printk(KERN_INFO "%s: %s found\n", __FUNCTION__,<br>>> usbvision_device_data[model].ModelString);<br>>><br>>> Memory alignment problem ? Why this probe is called even if there is no <br>>> device plugged-in ?<br>>> <br>> Very weird. It shouldn't be called when no device is plugged...<br>><br>> <br>>> By putting something like:<br>>> model = devid->driver_info;<br>>> if(model<0 || model
>HPG_WINTV) {<br>>> printk(KERN_INFO "model out of bounds %d\n",model);<br>>> return -ENODEV;<br>>> } else printk(KERN_INFO "model is %d\n",model);<br>>><br>>> The problem disappeared...<br>>> <br>><br>> A similar code is also present on em28xx. Anyway, it is better to have<br>> this kind of protection. I've added a patch, based on yours, fixing the<br>> bug. As you'd agreed, I've pushed the patches to master tree.<br>><br>> It is better, however, to check why it is calling the code, without a<br>> valid USB ID, since it may mean a future trouble...<br>><br>> Btw, I think we can also apply this one also:<br>><br>> diff -r 6b6805e3c76d linux/drivers/media/video/usbvision/usbvision-video.c<br>> ---
a/linux/drivers/media/video/usbvision/usbvision-video.c Sat Apr 14 15:17:08 2007 -0300<br>> +++ b/linux/drivers/media/video/usbvision/usbvision-video.c Sat Apr 14 15:19:06 2007 -0300<br>> @@ -1985,8 +1985,6 @@ static int __devinit usbvision_probe(str<br>> return -ENODEV;<br>> }<br>> <br>> - usb_get_dev(dev);<br>> -<br>> if ((usbvision = usbvision_alloc(dev)) == NULL) {<br>> err("%s: couldn't allocate USBVision struct", __FUNCTION__);<br>> return -ENOMEM;<br>><br>><br>> usb_get_dev() is already called previously on usbvision_probe.<br>><br>> <br>Latest v4l-dvb tree tested OK.<br><br>You are right
for usb_get_dev, only one call is necessary to increment <br>the reference count.<br><br>Thierry<br></div></div><br></div></div></body></html>