aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.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_sigmatel.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_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 61996a2f45d..ce30b459aee 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3851,6 +3851,15 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
3851 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ 3851 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
3852} 3852}
3853 3853
3854#ifdef CONFIG_SND_JACK
3855static void stac92xx_free_jack_priv(struct snd_jack *jack)
3856{
3857 struct sigmatel_jack *jacks = jack->private_data;
3858 jacks->nid = 0;
3859 jacks->jack = NULL;
3860}
3861#endif
3862
3854static int stac92xx_add_jack(struct hda_codec *codec, 3863static int stac92xx_add_jack(struct hda_codec *codec,
3855 hda_nid_t nid, int type) 3864 hda_nid_t nid, int type)
3856{ 3865{
@@ -3860,6 +3869,7 @@ static int stac92xx_add_jack(struct hda_codec *codec,
3860 int def_conf = snd_hda_codec_get_pincfg(codec, nid); 3869 int def_conf = snd_hda_codec_get_pincfg(codec, nid);
3861 int connectivity = get_defcfg_connect(def_conf); 3870 int connectivity = get_defcfg_connect(def_conf);
3862 char name[32]; 3871 char name[32];
3872 int err;
3863 3873
3864 if (connectivity && connectivity != AC_JACK_PORT_FIXED) 3874 if (connectivity && connectivity != AC_JACK_PORT_FIXED)
3865 return 0; 3875 return 0;
@@ -3876,10 +3886,15 @@ static int stac92xx_add_jack(struct hda_codec *codec,
3876 snd_hda_get_jack_connectivity(def_conf), 3886 snd_hda_get_jack_connectivity(def_conf),
3877 snd_hda_get_jack_location(def_conf)); 3887 snd_hda_get_jack_location(def_conf));
3878 3888
3879 return snd_jack_new(codec->bus->card, name, type, &jack->jack); 3889 err = snd_jack_new(codec->bus->card, name, type, &jack->jack);
3880#else 3890 if (err < 0) {
3881 return 0; 3891 jack->nid = 0;
3892 return err;
3893 }
3894 jack->jack->private_data = jack;
3895 jack->jack->private_free = stac92xx_free_jack_priv;
3882#endif 3896#endif
3897 return 0;
3883} 3898}
3884 3899
3885static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, 3900static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid,
@@ -4138,8 +4153,10 @@ static void stac92xx_free_jacks(struct hda_codec *codec)
4138 if (!codec->bus->shutdown && spec->jacks.list) { 4153 if (!codec->bus->shutdown && spec->jacks.list) {
4139 struct sigmatel_jack *jacks = spec->jacks.list; 4154 struct sigmatel_jack *jacks = spec->jacks.list;
4140 int i; 4155 int i;
4141 for (i = 0; i < spec->jacks.used; i++) 4156 for (i = 0; i < spec->jacks.used; i++, jacks++) {
4142 snd_device_free(codec->bus->card, &jacks[i].jack); 4157 if (jacks->jack)
4158 snd_device_free(codec->bus->card, jacks->jack);
4159 }
4143 } 4160 }
4144 snd_array_free(&spec->jacks); 4161 snd_array_free(&spec->jacks);
4145#endif 4162#endif