All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
To: vinod.koul@intel.com
Cc: alsa-devel@alsa-project.org, ckeepax@opensource.wolfsonmicro.com,
	pierre-louis.bossart@linux.intel.com
Subject: [tinycompress][PATCH 1/2] compress: copy final version of config	struct
Date: Wed, 5 Jun 2013 13:10:41 +0100	[thread overview]
Message-ID: <20130605121041.GB21556@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20130605120827.GA21556@opensource.wolfsonmicro.com>

compress_open() should delay taking a copy of the
config struct until we've finished modifying it.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
---
 compress.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/compress.c b/compress.c
index 7f56c78..373de85 100644
--- a/compress.c
+++ b/compress.c
@@ -235,7 +235,6 @@ struct compress *compress_open(unsigned int card, unsigned int device,
 	compress->config = calloc(1, sizeof(*config));
 	if (!compress->config)
 		goto input_fail;
-	memcpy(compress->config, config, sizeof(*compress->config));
 
 	snprintf(fn, sizeof(fn), "/dev/snd/comprC%uD%u", card, device);
 
@@ -277,6 +276,8 @@ struct compress *compress_open(unsigned int card, unsigned int device,
 		goto codec_fail;
 	}
 #endif
+
+	memcpy(compress->config, config, sizeof(*compress->config));
 	fill_compress_params(config, &params);
 
 	if (ioctl(compress->fd, SNDRV_COMPRESS_SET_PARAMS, &params)) {
-- 
1.7.2.5

  reply	other threads:[~2013-06-05 12:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 12:08 [tinycompress][PATCH 0/2] Fixes for write loop logic Richard Fitzgerald
2013-06-05 12:10 ` Richard Fitzgerald [this message]
2013-06-05 12:11 ` [tinycompress][PATCH 2/2] compress: do not poll if enough space to write remaining data Richard Fitzgerald
2013-06-07  0:30 ` [tinycompress][PATCH 0/2] Fixes for write loop logic Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130605121041.GB21556@opensource.wolfsonmicro.com \
    --to=rf@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.