From patchwork Sat Aug 25 19:53:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Biehl Pasquali X-Patchwork-Id: 10576203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8671139B for ; Sat, 25 Aug 2018 19:53:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADEE52A538 for ; Sat, 25 Aug 2018 19:53:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89AB22A53A; Sat, 25 Aug 2018 19:53:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A08B52A538 for ; Sat, 25 Aug 2018 19:53:41 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 62C9D26782B; Sat, 25 Aug 2018 21:53:37 +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 5249D267831; Sat, 25 Aug 2018 21:53:34 +0200 (CEST) Received: from mail-qt0-f177.google.com (mail-qt0-f177.google.com [209.85.216.177]) by alsa0.perex.cz (Postfix) with ESMTP id 1D82426773F for ; Sat, 25 Aug 2018 21:53:31 +0200 (CEST) Received: by mail-qt0-f177.google.com with SMTP id r37-v6so13927684qtc.0 for ; Sat, 25 Aug 2018 12:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=5kPDt+N+fK7UyZCEiy9Eo3FGa7tXNRvZr76bUtApFis=; b=roEOf7y8u/bMTNZqFq5fPPtgowz8Gq0HF3NM7UxRRaN8suPtvseJoOXy1Jq1tOXk8e rQpfCwEsQVDhwCzym/n09jWKXHWCk9J7YFBFddv/bBfASQK/2FyDCnd4OmxBBI2oGJzK OFPVnuHmfWyITXVqnPpT6NOch+7V1s7PSTjd1ynP3JxWBTWJ71N6vtCTCWNVJC36nXCl jy17ww/JaGkRY4ZYMPub9GAHWJZ6aPMr7RXZIthjFFeoOkLUIBqfmAwwzFDFbVlVJ7Qf CHpLbDw9gSwferkYJaKGEMIeklGjMl5mSnTz5Bvh7kIruPNWraL/pGHF/lDdPzvrZfO0 E1Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=5kPDt+N+fK7UyZCEiy9Eo3FGa7tXNRvZr76bUtApFis=; b=NGgGAqr0fl1znL8P6SLXSP5jooh3X69LlUpVvm1Akp24Qsuk3GgdGO/JpJ9pKYO5c8 yXSAhuTHeNsyzJAIv/gBFhgsU03RmD2dWCDlewO0goJsKc+4I/DizbkBTDpp+rcpXErw 4ApklBSxDKAhjtHKhDD+m0UrqkG6qcwXblj9mUg7sVy3lH2XnBAtUpe1+x78DwKutZHu LDrc45EJcfWW5Zek54tv7LVIVNKGrXtk+6oz/YQvLkinTT1nE2RxRaRifzxR1c4k5Tlu 9xbu4lpDSFemnpf+XDZDSc8ZwMCFeikEZyzau35ArQNCXI52XSqs9iiYLf03bP8smfHS /lGA== X-Gm-Message-State: APzg51DNDuQMvNjFjGojJheWztk6zKY5XZpS01xTpT3gPN2+qEFnjk3h quP5FYNjNEkzIKw/Qqa7spk= X-Google-Smtp-Source: ANB0VdZT3NUKzRDbh1x9g6JEE3RyY1cT3pGd+WAxnGqno62LUOk6lbyYK8S9maPtoplr3GwTzZ/KNw== X-Received: by 2002:aed:29c4:: with SMTP id o62-v6mr7469621qtd.134.1535226810337; Sat, 25 Aug 2018 12:53:30 -0700 (PDT) Received: from localhost.localdomain ([201.37.66.59]) by smtp.gmail.com with ESMTPSA id a5-v6sm6922952qkj.63.2018.08.25.12.53.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Aug 2018 12:53:29 -0700 (PDT) Date: Sat, 25 Aug 2018 16:53:23 -0300 From: Ricardo Biehl Pasquali To: tiwai@suse.de Message-ID: <20180825195322.GA4521@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH v3] ALSA: pcm: Return 0 when size < start_threshold in capture 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 In __snd_pcm_lib_xfer(), when capture, if state is PREPARED and size is less than start_threshold nothing can be done. As there is no error, 0 is returned. Signed-off-by: Ricardo Biehl Pasquali --- version 3: Set 'err' variable inside 'else' block. --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -2173,11 +2173,16 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(str goto _end_unlock; if (!is_playback && - runtime->status->state == SNDRV_PCM_STATE_PREPARED && - size >= runtime->start_threshold) { - err = snd_pcm_start(substream); - if (err < 0) + runtime->status->state == SNDRV_PCM_STATE_PREPARED) { + if (size >= runtime->start_threshold) { + err = snd_pcm_start(substream); + if (err < 0) + goto _end_unlock; + } else { + /* nothing to do */ + err = 0; goto _end_unlock; + } } runtime->twake = runtime->control->avail_min ? : 1;