From patchwork Sun Oct 19 07:07:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 5100601 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 49AB8C11AC for ; Sun, 19 Oct 2014 07:08:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4BBB1201CD for ; Sun, 19 Oct 2014 07:08:27 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1E449201BC for ; Sun, 19 Oct 2014 07:08:26 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1C9B726066D; Sun, 19 Oct 2014 09:08:25 +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, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id A32A62605B9; Sun, 19 Oct 2014 09:07:52 +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 DA11626051F; Sun, 19 Oct 2014 09:07:50 +0200 (CEST) Received: from mail.zonque.de (svenfoo.org [82.94.215.22]) by alsa0.perex.cz (Postfix) with ESMTP id 073062604FD for ; Sun, 19 Oct 2014 09:07:44 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.zonque.de (Postfix) with ESMTP id 6F830C1C1B; Sun, 19 Oct 2014 09:07:42 +0200 (CEST) Received: from mail.zonque.de ([127.0.0.1]) by localhost (rambrand.bugwerft.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NzsMmni6qOY6; Sun, 19 Oct 2014 09:07:42 +0200 (CEST) Received: from tamtam.fritz.box (p54AF4931.dip0.t-ipconnect.de [84.175.73.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.zonque.de (Postfix) with ESMTPSA id F0503C1124; Sun, 19 Oct 2014 09:07:41 +0200 (CEST) From: Daniel Mack To: alsa-devel@alsa-project.org Date: Sun, 19 Oct 2014 09:07:35 +0200 Message-Id: <1413702456-8624-2-git-send-email-daniel@zonque.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1413702456-8624-1-git-send-email-daniel@zonque.org> References: <1413702456-8624-1-git-send-email-daniel@zonque.org> Cc: broonie@kernel.org, Daniel Mack Subject: [alsa-devel] [PATCH 1/2] ASoC: soc-compress: consolidate two identical branches 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The actions taken in both branches are identical, so we can simplify the code. Spotted by Coverity. Signed-off-by: Daniel Mack --- sound/soc/soc-compress.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index cecfab3..590a82f 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -258,10 +258,7 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream) list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; - if (stream == SNDRV_PCM_STREAM_PLAYBACK) - dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); - else - dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); + dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; @@ -456,11 +453,7 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream, if (ret < 0) goto out; - if (stream == SNDRV_PCM_STREAM_PLAYBACK) - dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); - else - dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); - + dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; out: