Commit df619181 authored by Devin Heitmueller's avatar Devin Heitmueller Committed by Mauro Carvalho Chehab

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: default avatarDevin Heitmueller <devin.heitmueller@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 1a78db82
...@@ -415,6 +415,12 @@ static int em28xx_audio_init(struct em28xx *dev) ...@@ -415,6 +415,12 @@ static int em28xx_audio_init(struct em28xx *dev)
static int devnr; static int devnr;
int ret, err; int ret, err;
if (dev->has_audio_class) {
/* This device does not support the extension (in this case
the device is expecting the snd-usb-audio module */
return 0;
}
printk(KERN_INFO "em28xx-audio.c: probing for em28x1 " printk(KERN_INFO "em28xx-audio.c: probing for em28x1 "
"non standard usbaudio\n"); "non standard usbaudio\n");
printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
...@@ -458,6 +464,12 @@ static int em28xx_audio_fini(struct em28xx *dev) ...@@ -458,6 +464,12 @@ static int em28xx_audio_fini(struct em28xx *dev)
if (dev == NULL) if (dev == NULL)
return 0; return 0;
if (dev->has_audio_class) {
/* This device does not support the extension (in this case
the device is expecting the snd-usb-audio module */
return 0;
}
if (dev->adev) { if (dev->adev) {
snd_card_free(dev->adev->sndcard); snd_card_free(dev->adev->sndcard);
kfree(dev->adev); kfree(dev->adev);
......
...@@ -382,6 +382,11 @@ static int dvb_init(struct em28xx *dev) ...@@ -382,6 +382,11 @@ static int dvb_init(struct em28xx *dev)
int result = 0; int result = 0;
struct em28xx_dvb *dvb; struct em28xx_dvb *dvb;
if (!dev->has_dvb) {
/* This device does not support the extension */
return 0;
}
dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL); dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);
if (dvb == NULL) { if (dvb == NULL) {
...@@ -444,6 +449,11 @@ static int dvb_init(struct em28xx *dev) ...@@ -444,6 +449,11 @@ static int dvb_init(struct em28xx *dev)
static int dvb_fini(struct em28xx *dev) static int dvb_fini(struct em28xx *dev)
{ {
if (!dev->has_dvb) {
/* This device does not support the extension */
return 0;
}
if (dev->dvb) { if (dev->dvb) {
unregister_dvb(dev->dvb); unregister_dvb(dev->dvb);
dev->dvb = NULL; dev->dvb = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment