aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorDevin Heitmueller <devin.heitmueller@gmail.com>2008-06-10 11:34:35 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-06-26 14:58:44 -0400
commitdf619181631217e3166bb6c7538f981e0272617f (patch)
treec35f999f9a557490a997cd57eebe403216993ca5 /drivers/media
parent1a78db826973b9fa658d72291ec2007889e2faf7 (diff)
V4L/DVB (8017): Ensure em28xx extensions only get run against devs that support them
em28xx-audio.c em28xx-dvb.c - Em28xx extensions should ensure they are being only loaded against devices that support them. Deals with case where there are multiple em28xx devices, some of which have DVB (or ALSA) support and some do not. Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/em28xx/em28xx-audio.c12
-rw-r--r--drivers/media/video/em28xx/em28xx-dvb.c10
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
index 92b2a6db4fdc..343dff0f8a04 100644
--- a/drivers/media/video/em28xx/em28xx-audio.c
+++ b/drivers/media/video/em28xx/em28xx-audio.c
@@ -415,6 +415,12 @@ static int em28xx_audio_init(struct em28xx *dev)
415 static int devnr; 415 static int devnr;
416 int ret, err; 416 int ret, err;
417 417
418 if (dev->has_audio_class) {
419 /* This device does not support the extension (in this case
420 the device is expecting the snd-usb-audio module */
421 return 0;
422 }
423
418 printk(KERN_INFO "em28xx-audio.c: probing for em28x1 " 424 printk(KERN_INFO "em28xx-audio.c: probing for em28x1 "
419 "non standard usbaudio\n"); 425 "non standard usbaudio\n");
420 printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " 426 printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
@@ -458,6 +464,12 @@ static int em28xx_audio_fini(struct em28xx *dev)
458 if (dev == NULL) 464 if (dev == NULL)
459 return 0; 465 return 0;
460 466
467 if (dev->has_audio_class) {
468 /* This device does not support the extension (in this case
469 the device is expecting the snd-usb-audio module */
470 return 0;
471 }
472
461 if (dev->adev) { 473 if (dev->adev) {
462 snd_card_free(dev->adev->sndcard); 474 snd_card_free(dev->adev->sndcard);
463 kfree(dev->adev); 475 kfree(dev->adev);
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index 8cf4983f0039..0b2333ee07f8 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -382,6 +382,11 @@ static int dvb_init(struct em28xx *dev)
382 int result = 0; 382 int result = 0;
383 struct em28xx_dvb *dvb; 383 struct em28xx_dvb *dvb;
384 384
385 if (!dev->has_dvb) {
386 /* This device does not support the extension */
387 return 0;
388 }
389
385 dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL); 390 dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);
386 391
387 if (dvb == NULL) { 392 if (dvb == NULL) {
@@ -444,6 +449,11 @@ out_free:
444 449
445static int dvb_fini(struct em28xx *dev) 450static int dvb_fini(struct em28xx *dev)
446{ 451{
452 if (!dev->has_dvb) {
453 /* This device does not support the extension */
454 return 0;
455 }
456
447 if (dev->dvb) { 457 if (dev->dvb) {
448 unregister_dvb(dev->dvb); 458 unregister_dvb(dev->dvb);
449 dev->dvb = NULL; 459 dev->dvb = NULL;