Commit 284b4c92 authored by Wang YanQing's avatar Wang YanQing Committed by Takashi Iwai

ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe

When hda_codec_driver_probe meet error and return failure, we need
to free resource with patch_ops.free, or we will get resource leak.
Signed-off-by: default avatarWang YanQing <udknight@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent b06898d1
...@@ -100,7 +100,7 @@ static int hda_codec_driver_probe(struct device *dev) ...@@ -100,7 +100,7 @@ static int hda_codec_driver_probe(struct device *dev)
if (patch) { if (patch) {
err = patch(codec); err = patch(codec);
if (err < 0) if (err < 0)
goto error_module; goto error_module_put;
} }
err = snd_hda_codec_build_pcms(codec); err = snd_hda_codec_build_pcms(codec);
...@@ -120,6 +120,9 @@ static int hda_codec_driver_probe(struct device *dev) ...@@ -120,6 +120,9 @@ static int hda_codec_driver_probe(struct device *dev)
return 0; return 0;
error_module: error_module:
if (codec->patch_ops.free)
codec->patch_ops.free(codec);
error_module_put:
module_put(owner); module_put(owner);
error: error:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment