aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_conexant.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-04-14 10:15:29 -0400
committerTakashi Iwai <tiwai@suse.de>2009-04-14 10:15:29 -0400
commit95c0909961bc5ff18c78b2ab0d093cddc0a8b0b5 (patch)
tree410407b8f31bd9fbf348e8c77b7a35d41898fee1 /sound/pci/hda/patch_conexant.c
parent9d59065cd6fae841ca56c281189d5b8d0817d35f (diff)
ALSA: hda - Avoid call of snd_jack_report at release
Don't call snd_jack_report at release of sigmatel and conexnat codecs which results in Oops at unloading the module. The Oops is triggered by the power-up sequence during the free due to the pincfg restoration. Since the power-up sequence is involved with the unsol handling, the jack reporting may be issued during that. The Oops occurs with this jack reporting because the jack instances have been already released but the codec doesn't do the proper book-keeping. This patch adds the book-keeping of jack instances to avoid the access to bogus pointers. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_conexant.c')
-rw-r--r--sound/pci/hda/patch_conexant.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 1f2ad76ca94..56ce19e68cb 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -350,12 +350,20 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol,
350} 350}
351 351
352#ifdef CONFIG_SND_JACK 352#ifdef CONFIG_SND_JACK
353static void conexant_free_jack_priv(struct snd_jack *jack)
354{
355 struct conexant_jack *jacks = jack->private_data;
356 jacks->nid = 0;
357 jacks->jack = NULL;
358}
359
353static int conexant_add_jack(struct hda_codec *codec, 360static int conexant_add_jack(struct hda_codec *codec,
354 hda_nid_t nid, int type) 361 hda_nid_t nid, int type)
355{ 362{
356 struct conexant_spec *spec; 363 struct conexant_spec *spec;
357 struct conexant_jack *jack; 364 struct conexant_jack *jack;
358 const char *name; 365 const char *name;
366 int err;
359 367
360 spec = codec->spec; 368 spec = codec->spec;
361 snd_array_init(&spec->jacks, sizeof(*jack), 32); 369 snd_array_init(&spec->jacks, sizeof(*jack), 32);
@@ -368,7 +376,12 @@ static int conexant_add_jack(struct hda_codec *codec,
368 jack->nid = nid; 376 jack->nid = nid;
369 jack->type = type; 377 jack->type = type;
370 378
371 return snd_jack_new(codec->bus->card, name, type, &jack->jack); 379 err = snd_jack_new(codec->bus->card, name, type, &jack->jack);
380 if (err < 0)
381 return err;
382 jack->jack->private_data = jack;
383 jack->jack->private_free = conexant_free_jack_priv;
384 return 0;
372} 385}
373 386
374static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) 387static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid)
@@ -455,8 +468,10 @@ static void conexant_free(struct hda_codec *codec)
455 if (spec->jacks.list) { 468 if (spec->jacks.list) {
456 struct conexant_jack *jacks = spec->jacks.list; 469 struct conexant_jack *jacks = spec->jacks.list;
457 int i; 470 int i;
458 for (i = 0; i < spec->jacks.used; i++) 471 for (i = 0; i < spec->jacks.used; i++, jacks++) {
459 snd_device_free(codec->bus->card, &jacks[i].jack); 472 if (jacks->jack)
473 snd_device_free(codec->bus->card, jacks->jack);
474 }
460 snd_array_free(&spec->jacks); 475 snd_array_free(&spec->jacks);
461 } 476 }
462#endif 477#endif