alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: wm0010: Fix resource leak
@ 2013-07-31  9:15 Dimitris Papastamos
  2013-07-31 11:23 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Dimitris Papastamos @ 2013-07-31  9:15 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches

This fixes "https://bugzilla.kernel.org/show_bug.cgi?id=60650".

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/wm0010.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c
index f5e8356..285026c 100644
--- a/sound/soc/codecs/wm0010.c
+++ b/sound/soc/codecs/wm0010.c
@@ -410,6 +410,13 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec)
 			rec->command, rec->length);
 		len = rec->length + 8;
 
+		xfer = kzalloc(sizeof(*xfer), GFP_KERNEL | GFP_DMA);
+		if (!xfer) {
+			dev_err(codec->dev, "Failed to allocate xfer\n");
+			ret = -ENOMEM;
+			goto abort1;
+		}
+
 		out = kzalloc(len, GFP_KERNEL);
 		if (!out) {
 			dev_err(codec->dev,
@@ -417,6 +424,7 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec)
 			ret = -ENOMEM;
 			goto abort1;
 		}
+		xfer->t.rx_buf = out;
 
 		img = kzalloc(len, GFP_KERNEL);
 		if (!img) {
@@ -425,24 +433,16 @@ static int wm0010_firmware_load(const char *name, struct snd_soc_codec *codec)
 			ret = -ENOMEM;
 			goto abort1;
 		}
+		xfer->t.tx_buf = img;
 
 		byte_swap_64((u64 *)&rec->command, img, len);
 
-		xfer = kzalloc(sizeof(*xfer), GFP_KERNEL);
-		if (!xfer) {
-			dev_err(codec->dev, "Failed to allocate xfer\n");
-			ret = -ENOMEM;
-			goto abort1;
-		}
-
 		xfer->codec = codec;
 		list_add_tail(&xfer->list, &xfer_list);
 
 		spi_message_init(&xfer->m);
 		xfer->m.complete = wm0010_boot_xfer_complete;
 		xfer->m.context = xfer;
-		xfer->t.tx_buf = img;
-		xfer->t.rx_buf = out;
 		xfer->t.len = len;
 		xfer->t.bits_per_word = 8;
 
-- 
1.8.3.4

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

* Re: [PATCH] ASoC: wm0010: Fix resource leak
  2013-07-31  9:15 [PATCH] ASoC: wm0010: Fix resource leak Dimitris Papastamos
@ 2013-07-31 11:23 ` Mark Brown
  2013-07-31 12:00   ` Dimitris Papastamos
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2013-07-31 11:23 UTC (permalink / raw)
  To: Dimitris Papastamos; +Cc: alsa-devel, patches


[-- Attachment #1.1: Type: text/plain, Size: 459 bytes --]

On Wed, Jul 31, 2013 at 10:15:18AM +0100, Dimitris Papastamos wrote:

> +		xfer = kzalloc(sizeof(*xfer), GFP_KERNEL | GFP_DMA);
> +		if (!xfer) {
> +			dev_err(codec->dev, "Failed to allocate xfer\n");
> +			ret = -ENOMEM;
> +			goto abort1;
> +		}
> +

Why is this being allocated with GFP_DMA?  It's an internal data
structure, it's not going to be DMAed from.

Please also provide a changelog, a link to some address on the web isn't
a useful description.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

* Re: [PATCH] ASoC: wm0010: Fix resource leak
  2013-07-31 11:23 ` Mark Brown
@ 2013-07-31 12:00   ` Dimitris Papastamos
  2013-07-31 12:03     ` Dimitris Papastamos
  0 siblings, 1 reply; 4+ messages in thread
From: Dimitris Papastamos @ 2013-07-31 12:00 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches

On Wed, Jul 31, 2013 at 12:23:31PM +0100, Mark Brown wrote:
> On Wed, Jul 31, 2013 at 10:15:18AM +0100, Dimitris Papastamos wrote:
> 
> > +		xfer = kzalloc(sizeof(*xfer), GFP_KERNEL | GFP_DMA);
> > +		if (!xfer) {
> > +			dev_err(codec->dev, "Failed to allocate xfer\n");
> > +			ret = -ENOMEM;
> > +			goto abort1;
> > +		}
> > +
> 
> Why is this being allocated with GFP_DMA?  It's an internal data
> structure, it's not going to be DMAed from.

Yeah I will send a separate patch to fix that and then rebase
this patch on top.

> Please also provide a changelog, a link to some address on the web isn't
> a useful description.

Will do.

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

* Re: [PATCH] ASoC: wm0010: Fix resource leak
  2013-07-31 12:00   ` Dimitris Papastamos
@ 2013-07-31 12:03     ` Dimitris Papastamos
  0 siblings, 0 replies; 4+ messages in thread
From: Dimitris Papastamos @ 2013-07-31 12:03 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches

On Wed, Jul 31, 2013 at 01:00:25PM +0100, Dimitris Papastamos wrote:
> On Wed, Jul 31, 2013 at 12:23:31PM +0100, Mark Brown wrote:
> > On Wed, Jul 31, 2013 at 10:15:18AM +0100, Dimitris Papastamos wrote:
> > 
> > > +		xfer = kzalloc(sizeof(*xfer), GFP_KERNEL | GFP_DMA);
> > > +		if (!xfer) {
> > > +			dev_err(codec->dev, "Failed to allocate xfer\n");
> > > +			ret = -ENOMEM;
> > > +			goto abort1;
> > > +		}
> > > +
> > 
> > Why is this being allocated with GFP_DMA?  It's an internal data
> > structure, it's not going to be DMAed from.
> 
> Yeah I will send a separate patch to fix that and then rebase
> this patch on top.

Aw just noticed, this is basically a git am conflict that I resolved
incorrectly.

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

end of thread, other threads:[~2013-07-31 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-31  9:15 [PATCH] ASoC: wm0010: Fix resource leak Dimitris Papastamos
2013-07-31 11:23 ` Mark Brown
2013-07-31 12:00   ` Dimitris Papastamos
2013-07-31 12:03     ` Dimitris Papastamos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).