All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe
@ 2017-09-03 14:11 Wang YanQing
  2017-09-03 14:36 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Wang YanQing @ 2017-09-03 14:11 UTC (permalink / raw)
  To: tiwai; +Cc: alsa-devel, linux-kernel

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>
---
 sound/pci/hda/hda_bind.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
index 6efadbf..f1b1b7e 100644
--- a/sound/pci/hda/hda_bind.c
+++ b/sound/pci/hda/hda_bind.c
@@ -123,6 +123,8 @@ static int hda_codec_driver_probe(struct device *dev)
 	module_put(owner);
 
  error:
+	if (codec->patch_ops.free)
+		codec->patch_ops.free(codec);
 	snd_hda_codec_cleanup_for_unbind(codec);
 	return err;
 }
-- 
1.8.5.6.2.g3d8a54e.dirty

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe
  2017-09-03 14:11 [PATCH] ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe Wang YanQing
@ 2017-09-03 14:36 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2017-09-03 14:36 UTC (permalink / raw)
  To: Wang YanQing; +Cc: alsa-devel, linux-kernel

On Sun, 03 Sep 2017 16:11:22 +0200,
Wang YanQing wrote:
> 
> 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.

No, the codec driver is responsible to free resources in its error
path.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-03 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-03 14:11 [PATCH] ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe Wang YanQing
2017-09-03 14:36 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.