mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* re: [PATCH 3/9] ALSA: emu10k1: remove redundant variable attn
@ 2018-08-01 13:03 Walter Harms
  2018-08-01 13:14 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Walter Harms @ 2018-08-01 13:03 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Jaya Kumar, alsa-devel
  Cc: kernel-janitors, linux-kernel

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

Variable attn is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'attn' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/pci/emu10k1/emupcm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 69f9b100bd24..26f6eda3e766 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -290,7 +290,7 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1
*emu,
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	unsigned int silent_page, tmp;
 	int voice, stereo, w_16;
-	unsigned char attn, send_amount[8];
+	unsigned char send_amount[8];
 	unsigned char send_routing[8];
 	unsigned long flags;
 	unsigned int pitch_target;
@@ -313,7 +313,6 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1
*emu,
  	/* volume parameters */
 	if (extra) {
-		attn = 0;
 		memset(send_routing, 0, sizeof(send_routing));
 		send_routing[0] = 0;
 		send_routing[1] = 1;


IMHO, this code is a bit fishy.
The memset() sould go in the init section
and in the else branch tmp is set, maybe its an idea
to set it here also (for symmetry)
just my 2 cents,

re,
 wh



-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/9] ALSA: emu10k1: remove redundant variable attn
  2018-08-01 13:03 [PATCH 3/9] ALSA: emu10k1: remove redundant variable attn Walter Harms
@ 2018-08-01 13:14 ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2018-08-01 13:14 UTC (permalink / raw)
  To: Walter Harms
  Cc: alsa-devel, Jaya Kumar, Jaroslav Kysela, kernel-janitors, linux-kernel

On Wed, 01 Aug 2018 15:03:45 +0200,
Walter Harms wrote:
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> Variable attn is being assigned but is never used hence it is
> redundant and can be removed.
> 
> Cleans up clang warning:
> warning: variable 'attn' set but not used [-Wunused-but-set-variable]
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  sound/pci/emu10k1/emupcm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
> index 69f9b100bd24..26f6eda3e766 100644
> --- a/sound/pci/emu10k1/emupcm.c
> +++ b/sound/pci/emu10k1/emupcm.c
> @@ -290,7 +290,7 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1
> *emu,
>  	struct snd_pcm_runtime *runtime = substream->runtime;
>  	unsigned int silent_page, tmp;
>  	int voice, stereo, w_16;
> -	unsigned char attn, send_amount[8];
> +	unsigned char send_amount[8];
>  	unsigned char send_routing[8];
>  	unsigned long flags;
>  	unsigned int pitch_target;
> @@ -313,7 +313,6 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1
> *emu,
>   	/* volume parameters */
>  	if (extra) {
> -		attn = 0;
>  		memset(send_routing, 0, sizeof(send_routing));
>  		send_routing[0] = 0;
>  		send_routing[1] = 1;
> 
> 
> IMHO, this code is a bit fishy.
> The memset() sould go in the init section
> and in the else branch tmp is set, maybe its an idea
> to set it here also (for symmetry)

What does it have to do with this patch...?

The code there is OK, although it could be a bit optimized with a
static array for the fixed routing.  But it's pretty minor and it's no
hot path, so no need to bother complicating things.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/9] ALSA: emu10k1: remove redundant variable attn
  2018-08-01 10:47 ` [PATCH 3/9] ALSA: emu10k1: remove redundant variable attn Colin King
@ 2018-08-01 12:01   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2018-08-01 12:01 UTC (permalink / raw)
  To: Colin King
  Cc: alsa-devel, Jaya Kumar, Liam Girdwood, Maxime Coquelin,
	Mark Brown, linux-arm-kernel, Jaroslav Kysela, Alexandre Torgue,
	Arnaud Pouliquen, Olivier Moysan, kernel-janitors, linux-kernel

On Wed, 01 Aug 2018 12:47:36 +0200,
Colin King wrote:
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> Variable attn is being assigned but is never used hence it is
> redundant and can be removed.
> 
> Cleans up clang warning:
> warning: variable 'attn' set but not used [-Wunused-but-set-variable]
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thanks.


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/9] ALSA: emu10k1: remove redundant variable attn
  2018-08-01 10:47 [PATCH 0/9] ALSA: remove redundant variables Colin King
@ 2018-08-01 10:47 ` Colin King
  2018-08-01 12:01   ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Colin King @ 2018-08-01 10:47 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Jaya Kumar, Liam Girdwood,
	Mark Brown, Olivier Moysan, Arnaud Pouliquen, Maxime Coquelin,
	Alexandre Torgue, alsa-devel, linux-arm-kernel
  Cc: kernel-janitors, linux-kernel

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

Variable attn is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'attn' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 sound/pci/emu10k1/emupcm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 69f9b100bd24..26f6eda3e766 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -290,7 +290,7 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu,
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	unsigned int silent_page, tmp;
 	int voice, stereo, w_16;
-	unsigned char attn, send_amount[8];
+	unsigned char send_amount[8];
 	unsigned char send_routing[8];
 	unsigned long flags;
 	unsigned int pitch_target;
@@ -313,7 +313,6 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu,
 
 	/* volume parameters */
 	if (extra) {
-		attn = 0;
 		memset(send_routing, 0, sizeof(send_routing));
 		send_routing[0] = 0;
 		send_routing[1] = 1;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-01 13:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-01 13:03 [PATCH 3/9] ALSA: emu10k1: remove redundant variable attn Walter Harms
2018-08-01 13:14 ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2018-08-01 10:47 [PATCH 0/9] ALSA: remove redundant variables Colin King
2018-08-01 10:47 ` [PATCH 3/9] ALSA: emu10k1: remove redundant variable attn Colin King
2018-08-01 12:01   ` Takashi Iwai

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®