aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/radio')
-rw-r--r--drivers/media/radio/dsbr100.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c
index 3bd07f7e3774..36c0e3651502 100644
--- a/drivers/media/radio/dsbr100.c
+++ b/drivers/media/radio/dsbr100.c
@@ -33,6 +33,9 @@
33 33
34 History: 34 History:
35 35
36 Version 0.43:
37 Oliver Neukum: avoided DMA coherency issue
38
36 Version 0.42: 39 Version 0.42:
37 Converted dsbr100 to use video_ioctl2 40 Converted dsbr100 to use video_ioctl2
38 by Douglas Landgraf <dougsland@gmail.com> 41 by Douglas Landgraf <dougsland@gmail.com>
@@ -135,7 +138,7 @@ module_param(radio_nr, int, 0);
135struct dsbr100_device { 138struct dsbr100_device {
136 struct usb_device *usbdev; 139 struct usb_device *usbdev;
137 struct video_device *videodev; 140 struct video_device *videodev;
138 unsigned char transfer_buffer[TB_LEN]; 141 u8 *transfer_buffer;
139 int curfreq; 142 int curfreq;
140 int stereo; 143 int stereo;
141 int users; 144 int users;
@@ -237,10 +240,7 @@ static void dsbr100_getstat(struct dsbr100_device *radio)
237/* handle unplugging of the device, release data structures 240/* handle unplugging of the device, release data structures
238if nothing keeps us from doing it. If something is still 241if nothing keeps us from doing it. If something is still
239keeping us busy, the release callback of v4l will take care 242keeping us busy, the release callback of v4l will take care
240of releasing it. stv680.c does not relase its private 243of releasing it. */
241data, so I don't do this here either. Checking out the
242code I'd expect I better did that, but if there's a memory
243leak here it's tiny (~50 bytes per disconnect) */
244static void usb_dsbr100_disconnect(struct usb_interface *intf) 244static void usb_dsbr100_disconnect(struct usb_interface *intf)
245{ 245{
246 struct dsbr100_device *radio = usb_get_intfdata(intf); 246 struct dsbr100_device *radio = usb_get_intfdata(intf);
@@ -250,6 +250,7 @@ static void usb_dsbr100_disconnect(struct usb_interface *intf)
250 video_unregister_device(radio->videodev); 250 video_unregister_device(radio->videodev);
251 radio->videodev = NULL; 251 radio->videodev = NULL;
252 if (radio->users) { 252 if (radio->users) {
253 kfree(radio->transfer_buffer);
253 kfree(radio); 254 kfree(radio);
254 } else { 255 } else {
255 radio->removed = 1; 256 radio->removed = 1;
@@ -425,6 +426,7 @@ static int usb_dsbr100_close(struct inode *inode, struct file *file)
425 return -ENODEV; 426 return -ENODEV;
426 radio->users = 0; 427 radio->users = 0;
427 if (radio->removed) { 428 if (radio->removed) {
429 kfree(radio->transfer_buffer);
428 kfree(radio); 430 kfree(radio);
429 } 431 }
430 return 0; 432 return 0;
@@ -471,7 +473,12 @@ static int usb_dsbr100_probe(struct usb_interface *intf,
471 473
472 if (!(radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL))) 474 if (!(radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL)))
473 return -ENOMEM; 475 return -ENOMEM;
476 if (!(radio->transfer_buffer = kmalloc(TB_LEN, GFP_KERNEL))) {
477 kfree(radio);
478 return -ENOMEM;
479 }
474 if (!(radio->videodev = video_device_alloc())) { 480 if (!(radio->videodev = video_device_alloc())) {
481 kfree(radio->transfer_buffer);
475 kfree(radio); 482 kfree(radio);
476 return -ENOMEM; 483 return -ENOMEM;
477 } 484 }
@@ -485,6 +492,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf,
485 if (video_register_device(radio->videodev, VFL_TYPE_RADIO,radio_nr)) { 492 if (video_register_device(radio->videodev, VFL_TYPE_RADIO,radio_nr)) {
486 warn("Could not register video device"); 493 warn("Could not register video device");
487 video_device_release(radio->videodev); 494 video_device_release(radio->videodev);
495 kfree(radio->transfer_buffer);
488 kfree(radio); 496 kfree(radio);
489 return -EIO; 497 return -EIO;
490 } 498 }