diff options
Diffstat (limited to 'sound/pci/hda/hda_beep.c')
-rw-r--r-- | sound/pci/hda/hda_beep.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 336b4b3a80b9..e6cf2a22c407 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -184,6 +184,7 @@ EXPORT_SYMBOL_HDA(snd_hda_enable_beep_device); | |||
184 | int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | 184 | int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) |
185 | { | 185 | { |
186 | struct hda_beep *beep; | 186 | struct hda_beep *beep; |
187 | int err; | ||
187 | 188 | ||
188 | if (!snd_hda_get_bool_hint(codec, "beep")) | 189 | if (!snd_hda_get_bool_hint(codec, "beep")) |
189 | return 0; /* disabled explicitly by hints */ | 190 | return 0; /* disabled explicitly by hints */ |
@@ -201,19 +202,16 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid) | |||
201 | 202 | ||
202 | beep->nid = nid; | 203 | beep->nid = nid; |
203 | beep->codec = codec; | 204 | beep->codec = codec; |
204 | beep->mode = codec->beep_mode; | ||
205 | codec->beep = beep; | 205 | codec->beep = beep; |
206 | 206 | ||
207 | INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); | 207 | INIT_WORK(&beep->beep_work, &snd_hda_generate_beep); |
208 | mutex_init(&beep->mutex); | 208 | mutex_init(&beep->mutex); |
209 | 209 | ||
210 | if (beep->mode) { | 210 | err = snd_hda_do_attach(beep); |
211 | int err = snd_hda_do_attach(beep); | 211 | if (err < 0) { |
212 | if (err < 0) { | 212 | kfree(beep); |
213 | kfree(beep); | 213 | codec->beep = NULL; |
214 | codec->beep = NULL; | 214 | return err; |
215 | return err; | ||
216 | } | ||
217 | } | 215 | } |
218 | 216 | ||
219 | return 0; | 217 | return 0; |