summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorWang YanQing <udknight@gmail.com>2017-09-04 17:17:09 +0200
committerTakashi Iwai <tiwai@suse.de>2017-09-04 17:33:53 +0200
commit284b4c9289766c6294d4c6292aea565f78215b0e (patch)
treea38c9c32ba4a1d2ea7d10f2f37c557e7cc803c19 /sound/pci/hda
parentMerge tag 'asoc-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/broon... (diff)
downloadlinux-284b4c9289766c6294d4c6292aea565f78215b0e.tar.xz
linux-284b4c9289766c6294d4c6292aea565f78215b0e.zip
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: Wang YanQing <udknight@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/hda_bind.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
index 6efadbfb3fe3..d361bb77ca00 100644
--- a/sound/pci/hda/hda_bind.c
+++ b/sound/pci/hda/hda_bind.c
@@ -100,7 +100,7 @@ static int hda_codec_driver_probe(struct device *dev)
if (patch) {
err = patch(codec);
if (err < 0)
- goto error_module;
+ goto error_module_put;
}
err = snd_hda_codec_build_pcms(codec);
@@ -120,6 +120,9 @@ static int hda_codec_driver_probe(struct device *dev)
return 0;
error_module:
+ if (codec->patch_ops.free)
+ codec->patch_ops.free(codec);
+ error_module_put:
module_put(owner);
error: