From: Michel Ludwig Date: Thu, 14 Jun 2007 20:19:59 +0000 (-0300) Subject: V4L/DVB (12772): tm6000: fix module load/unload X-Git-Tag: v2.6.35-rc1~480^2~532 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=22927e8e0007fe653dd2824cf86b799b43e3bff8;p=profile%2Fivi%2Fkernel-x86-ivi.git V4L/DVB (12772): tm6000: fix module load/unload Signed-off-by: Michel Ludwig Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index b0719a5..81f5ea6 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c @@ -230,6 +230,7 @@ static int tm6000_usb_probe(struct usb_interface *interface, /* Increment usage count */ tm6000_devused|=1<tm6000_corelist); dev->udev= usbdev; dev->model=id->driver_info; snprintf(dev->name, 29, "tm6000 #%d", nr); @@ -354,8 +355,6 @@ static void tm6000_usb_disconnect(struct usb_interface *interface) if (!dev) return; - tm6000_i2c_unregister(dev); - printk("tm6000: disconnecting %s\n", dev->name); mutex_lock(&dev->lock); @@ -369,6 +368,7 @@ static void tm6000_usb_disconnect(struct usb_interface *interface) dev->state |= DEV_DISCONNECTED; mutex_unlock(&dev->lock); + kfree(dev); } static struct usb_driver tm6000_usb_driver = { diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 970f3a1..ffd2fe7 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c @@ -1528,15 +1528,14 @@ int tm6000_v4l2_register(struct tm6000_core *dev) int tm6000_v4l2_unregister(struct tm6000_core *dev) { struct tm6000_core *h; - struct list_head *list; + struct list_head *pos, *tmp; - while (!list_empty(&tm6000_corelist)) { - list = tm6000_corelist.next; - h = list_entry(list, struct tm6000_core, tm6000_corelist); + video_unregister_device(&dev->vfd); + + list_for_each_safe(pos, tmp, &tm6000_corelist) { + h = list_entry(pos, struct tm6000_core, tm6000_corelist); if (h == dev) { - video_unregister_device(&dev->vfd); list_del(list); - kfree (h); } }