提交 54f7190b 编写于 作者: T Takashi Iwai

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: NTakashi Iwai <tiwai@suse.de>
上级 411fe85c
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册