From patchwork Fri Apr 4 18:27:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Eikum X-Patchwork-Id: 3940021 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 16D2E9F1EE for ; Fri, 4 Apr 2014 18:27:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C8AD20383 for ; Fri, 4 Apr 2014 18:27:52 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5333B20136 for ; Fri, 4 Apr 2014 18:27:51 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8E205265843; Fri, 4 Apr 2014 20:27:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 803F0265828; Fri, 4 Apr 2014 20:27:38 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 086AF265828; Fri, 4 Apr 2014 20:27:37 +0200 (CEST) Received: from mail.codeweavers.com (mail.codeweavers.com [216.251.189.131]) by alsa0.perex.cz (Postfix) with ESMTP id D749E265813; Fri, 4 Apr 2014 20:27:28 +0200 (CEST) Received: from foghorn.codeweavers.com ([216.251.189.130]) by mail.codeweavers.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1WW8pr-0004c0-0L; Fri, 04 Apr 2014 13:27:27 -0500 Date: Fri, 4 Apr 2014 13:27:25 -0500 From: Andrew Eikum To: patch@alsa-project.org, alsa-devel@alsa-project.org Message-ID: <20140404182725.GQ24575@foghorn.codeweavers.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Subject: [alsa-devel] [PATCH alsa-lib] pcm: rate: Don't return negative frame count on success in rewind X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP snd_pcm_rewind is documented to return <0 on failure and >=0 on success. Signed-off-by: Andrew Eikum --- I checked all other rewind implementations, and this was the only one that obviously had this bug. diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 54a3e67..2eb4b1b 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -702,7 +702,7 @@ static snd_pcm_sframes_t snd_pcm_rate_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f snd_atomic_write_begin(&rate->watom); n = snd_pcm_rate_move_applptr(pcm, -frames); snd_atomic_write_end(&rate->watom); - return n; + return n < 0 ? -n : n; } static snd_pcm_sframes_t snd_pcm_rate_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)