summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-12-27 13:27:39 +0100
committerTakashi Iwai <tiwai@suse.de>2009-12-27 13:34:01 +0100
commit54f7190b23080c7ac32078ed6a346bdc591ebef1 (patch)
treee6645e96a9aac1c9248ebf6d8a23b9de35dd2edf /sound
parent411fe85c7653f51403c2a6fd9026b0db2ab19478 (diff)
downloadop-kernel-dev-54f7190b23080c7ac32078ed6a346bdc591ebef1.zip
op-kernel-dev-54f7190b23080c7ac32078ed6a346bdc591ebef1.tar.gz
ALSA: hda - Fix Oops at reloading beep devices
The recent change for supporting dynamic beep device allocation caused a problem resulting in Oops at reloading the driver. Also, it ignores the error from input device registration. This patch fixes the wrong check in snd_hda_detach_beep_device(), and returns an error when the input device registration fails properly. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_beep.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index ca3c57a..e4581a42 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -239,8 +239,12 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
mutex_init(&beep->mutex);
if (beep->mode == HDA_BEEP_MODE_ON) {
- beep->enabled = 1;
- snd_hda_do_register(&beep->register_work);
+ int err = snd_hda_do_attach(beep);
+ if (err < 0) {
+ kfree(beep);
+ codec->beep = NULL;
+ return err;
+ }
}
return 0;
@@ -253,7 +257,7 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
if (beep) {
cancel_work_sync(&beep->register_work);
cancel_delayed_work(&beep->unregister_work);
- if (beep->enabled)
+ if (beep->dev)
snd_hda_do_detach(beep);
codec->beep = NULL;
kfree(beep);
OpenPOWER on IntegriCloud