diff options
author | Wang YanQing <udknight@gmail.com> | 2017-09-04 11:17:09 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-09-04 11:33:53 -0400 |
commit | 284b4c9289766c6294d4c6292aea565f78215b0e (patch) | |
tree | a38c9c32ba4a1d2ea7d10f2f37c557e7cc803c19 | |
parent | b06898d119f6b8dba7b318ad73558ce2d39161e8 (diff) |
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>
-rw-r--r-- | sound/pci/hda/hda_bind.c | 5 |
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) | |||
100 | if (patch) { | 100 | if (patch) { |
101 | err = patch(codec); | 101 | err = patch(codec); |
102 | if (err < 0) | 102 | if (err < 0) |
103 | goto error_module; | 103 | goto error_module_put; |
104 | } | 104 | } |
105 | 105 | ||
106 | err = snd_hda_codec_build_pcms(codec); | 106 | err = snd_hda_codec_build_pcms(codec); |
@@ -120,6 +120,9 @@ static int hda_codec_driver_probe(struct device *dev) | |||
120 | return 0; | 120 | return 0; |
121 | 121 | ||
122 | error_module: | 122 | error_module: |
123 | if (codec->patch_ops.free) | ||
124 | codec->patch_ops.free(codec); | ||
125 | error_module_put: | ||
123 | module_put(owner); | 126 | module_put(owner); |
124 | 127 | ||
125 | error: | 128 | error: |