alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Jeeja KP <jeeja.kp@intel.com>,
	alsa-devel@alsa-project.org, broonie@opensource.wolfsonmicro.com,
	liam.r.girdwood@intel.com
Subject: Re: [PATCH] compress: add support for gapless playback
Date: Wed, 13 Feb 2013 22:33:22 +0530	[thread overview]
Message-ID: <20130213170322.GA7777@intel.com> (raw)
In-Reply-To: <s5hzjz8upzo.wl%tiwai@suse.de>

On Wed, Feb 13, 2013 at 05:40:11PM +0100, Takashi Iwai wrote:
> At Wed, 13 Feb 2013 08:00:34 -0800,
> Vinod Koul wrote:
> > 
> > +static int
> > +snd_compr_get_metadata(struct snd_compr_stream *stream, unsigned long arg)
> > +{
> > +	struct snd_compr_metadata *metadata;
> > +	int retval;
> > +
> > +	if (!stream->ops->get_metadata)
> > +		return -ENXIO;
> > +
> > +	metadata = kmalloc(sizeof(*metadata), GFP_KERNEL);
> 
> There is no merit to use kmalloc just for two integers at all.
> Simply put on stack:
> 	struct snd_compr_metadata metdata;
> 	if (copy_from_user(&metadata, (void __user *)arg, sizeof(metadata)))
> 	...
while doing this I had thought on this, but my laziness got better of me :(
> 
> Ditto for snd_compr_set_metadata().
> 
> > +static int snd_compr_partial_drain(struct snd_compr_stream *stream)
> > +{
> > +	int retval;
> > +	if (stream->runtime->state == SNDRV_PCM_STATE_PREPARED ||
> > +			stream->runtime->state == SNDRV_PCM_STATE_SETUP)
> > +		return -EPERM;
> > +	/* stream can be drained only when next track has been signalled */
> > +	if (stream->next_track == false)
> > +		return -EPERM;
> > +
> > +	retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_PARTIAL_DRAIN);
> > +	if (retval)
> > +		pr_err("Partial drain returned failure\n");
> 
> I don't think it's good to spew errors.
ok
> 
> Also, the initialization of new stream fields is missing in other
> places like prepare callback?  Otherwise the values will retain.
The stream is created at open. Since it used kzalloc, these variables would be
init to false.

--
~Vinod

  reply	other threads:[~2013-02-13 17:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-13 16:00 [PATCH] compress: add support for gapless playback Vinod Koul
2013-02-13 16:40 ` Takashi Iwai
2013-02-13 17:03   ` Vinod Koul [this message]
2013-02-13 17:15     ` Takashi Iwai
2013-02-13 17:21       ` Vinod Koul
  -- strict thread matches above, loose matches on Subject: below --
2013-02-14 11:22 Vinod Koul
2013-02-14 11:31 ` Takashi Iwai
2013-02-14 13:37   ` Vinod Koul
2013-02-14  8:42 Vinod Koul
2013-02-14  9:13 ` Takashi Iwai
2013-02-14  9:32   ` Vinod Koul
2013-02-14  9:45     ` Takashi Iwai
2013-02-14 11:06       ` Vinod Koul
2013-02-12 18:31 Vinod Koul
2013-02-13  6:23 ` Takashi Iwai
2013-02-13  6:35   ` Vinod Koul
2013-02-13  7:37     ` Takashi Iwai
2013-02-13 11:34       ` Mark Brown
2013-02-13 13:39       ` Vinod Koul
2013-02-11 12:22 Vinod Koul
2013-02-11 13:41 ` Takashi Iwai
2013-02-11 13:41   ` Vinod Koul
2013-02-11 14:38     ` Takashi Iwai
2013-02-11 14:55       ` Vinod Koul
2013-02-11 15:30         ` Takashi Iwai

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=20130213170322.GA7777@intel.com \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=jeeja.kp@intel.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=tiwai@suse.de \
    /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 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).