From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754050AbdKNR1h (ORCPT ); Tue, 14 Nov 2017 12:27:37 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:35481 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752360AbdKNR1a (ORCPT ); Tue, 14 Nov 2017 12:27:30 -0500 From: Colin King To: Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ALSA: synth: emux: remove redundant test for r <= 13 Date: Tue, 14 Nov 2017 17:26:53 +0000 Message-Id: <20171114172653.6690-1-colin.king@canonical.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King The calculation r = (3 - ((rate >> 6) & 3)) * 3 results in r being 0, 3, 6 or 9 and so the check (13 > r) is always true and hence we can remove the redundant check and the else path. Detected by CoverityScan, CID#744415 ("Logically dead code") Signed-off-by: Colin Ian King --- sound/synth/emux/soundfont.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c index 31a4ea94830e..0beb5a737c8b 100644 --- a/sound/synth/emux/soundfont.c +++ b/sound/synth/emux/soundfont.c @@ -858,10 +858,7 @@ calc_gus_envelope_time(int rate, int start, int end) p = rate & 0x3f; t = end - start; if (t < 0) t = -t; - if (13 > r) - t = t << (13 - r); - else - t = t >> (r - 13); + t = t << (13 - r); return (t * 10) / (p * 441); } -- 2.14.1