mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin King <colin.king@canonical.com>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	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	[thread overview]
Message-ID: <20171114172653.6690-1-colin.king@canonical.com> (raw)

From: Colin Ian King <colin.king@canonical.com>

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 <colin.king@canonical.com>
---
 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

             reply	other threads:[~2017-11-14 17:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 17:26 Colin King [this message]
2017-11-17 11:06 ` Takashi Iwai
2017-11-17 11:07   ` Colin Ian King
2017-11-17 11:11     ` walter harms

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=20171114172653.6690-1-colin.king@canonical.com \
    --to=colin.king@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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

all inboxes | Powered by JetHome®