linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ALSA: Minor cleanup for unused variables
@ 2022-09-30 10:38 Chen Zhongjin
  2022-09-30 10:38 ` [PATCH -next 1/4] ALSA: rawmidi: Remove unused variable 'dest_frames' Chen Zhongjin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chen Zhongjin @ 2022-09-30 10:38 UTC (permalink / raw)
  To: linux-kernel, alsa-devel
  Cc: perex, tiwai, jayakumar.alsa, chenzhongjin, wangjianli

This patch set contains some cleanups that removes unused variables.
Reported by Clang [-Wunused-but-set-variable]

Some of them are forgotten to deleted and some are never used since the
beginning.

Chen Zhongjin (4):
  ALSA: rawmidi: Remove unused variable 'dest_frames'
  ALSA: cs5535audio: Remove unused variable 'loop'
  ALSA: cs5535audio: Remove unused variable 'loop_count'
  ALSA: cs5535audio: Remove unused variable 'desc_addr'

 sound/core/rawmidi.c                    | 2 --
 sound/pci/asihpi/asihpi.c               | 2 --
 sound/pci/asihpi/hpi6000.c              | 2 --
 sound/pci/cs5535audio/cs5535audio_pcm.c | 4 +---
 4 files changed, 1 insertion(+), 9 deletions(-)

-- 
2.17.1


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

* [PATCH -next 1/4] ALSA: rawmidi: Remove unused variable 'dest_frames'
  2022-09-30 10:38 [PATCH 0/4] ALSA: Minor cleanup for unused variables Chen Zhongjin
@ 2022-09-30 10:38 ` Chen Zhongjin
  2022-09-30 10:38 ` [PATCH -next 2/4] ALSA: cs5535audio: Remove unused variable 'loop' Chen Zhongjin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Chen Zhongjin @ 2022-09-30 10:38 UTC (permalink / raw)
  To: linux-kernel, alsa-devel
  Cc: perex, tiwai, jayakumar.alsa, chenzhongjin, wangjianli

Reported by Clang [-Wunused-but-set-variable]

'commit 08fdced60ca0 ("ALSA: rawmidi: Add framing mode")'
This commit introduced the variable 'dest_frames'.
However this variable was never used except iterates itself.

It seems that it's some undeleted debug code. Remove it for code
cleaning.

Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
---
 sound/core/rawmidi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 6963d5a487b3..3cd944386e51 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -1050,7 +1050,6 @@ static int receive_with_tstamp_framing(struct snd_rawmidi_substream *substream,
 	struct snd_rawmidi_runtime *runtime = substream->runtime;
 	struct snd_rawmidi_framing_tstamp *dest_ptr;
 	struct snd_rawmidi_framing_tstamp frame = { .tv_sec = tstamp->tv_sec, .tv_nsec = tstamp->tv_nsec };
-	int dest_frames = 0;
 	int orig_count = src_count;
 	int frame_size = sizeof(struct snd_rawmidi_framing_tstamp);
 
@@ -1077,7 +1076,6 @@ static int receive_with_tstamp_framing(struct snd_rawmidi_substream *substream,
 		runtime->avail += frame_size;
 		runtime->hw_ptr += frame_size;
 		runtime->hw_ptr %= runtime->buffer_size;
-		dest_frames++;
 	}
 	return orig_count - src_count;
 }
-- 
2.17.1


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

* [PATCH -next 2/4] ALSA: cs5535audio: Remove unused variable 'loop'
  2022-09-30 10:38 [PATCH 0/4] ALSA: Minor cleanup for unused variables Chen Zhongjin
  2022-09-30 10:38 ` [PATCH -next 1/4] ALSA: rawmidi: Remove unused variable 'dest_frames' Chen Zhongjin
@ 2022-09-30 10:38 ` Chen Zhongjin
  2022-09-30 10:38 ` [PATCH -next 3/4] ALSA: cs5535audio: Remove unused variable 'loop_count' Chen Zhongjin
  2022-09-30 10:38 ` [PATCH -next 4/4] ALSA: cs5535audio: Remove unused variable 'desc_addr' Chen Zhongjin
  3 siblings, 0 replies; 5+ messages in thread
From: Chen Zhongjin @ 2022-09-30 10:38 UTC (permalink / raw)
  To: linux-kernel, alsa-devel
  Cc: perex, tiwai, jayakumar.alsa, chenzhongjin, wangjianli

Reported by Clang [-Wunused-but-set-variable]

The variable 'loop' is introduced to print log but this commit
'commit a6477134db11 ("ALSA: asihpi: Update debug printing")'
had updated the printing and 'loop' was not printed.

Now the variable is not used by other code. Remove it for code cleaning.

Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
---
 sound/pci/asihpi/asihpi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index 5e1f9f10051b..7041c2cba564 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -725,7 +725,6 @@ static void snd_card_asihpi_timer_function(struct timer_list *t)
 	unsigned int pcm_buf_dma_ofs, min_buf_pos = 0;
 	unsigned int remdata, xfercount, next_jiffies;
 	int first = 1;
-	int loops = 0;
 	u16 state;
 	u32 buffer_size, bytes_avail, samples_played, on_card_bytes;
 	char name[16];
@@ -806,7 +805,6 @@ static void snd_card_asihpi_timer_function(struct timer_list *t)
 			(unsigned long)frames_to_bytes(runtime,
 						runtime->control->appl_ptr)
 		);
-		loops++;
 	}
 	pcm_buf_dma_ofs = min_buf_pos;
 
-- 
2.17.1


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

* [PATCH -next 3/4] ALSA: cs5535audio: Remove unused variable 'loop_count'
  2022-09-30 10:38 [PATCH 0/4] ALSA: Minor cleanup for unused variables Chen Zhongjin
  2022-09-30 10:38 ` [PATCH -next 1/4] ALSA: rawmidi: Remove unused variable 'dest_frames' Chen Zhongjin
  2022-09-30 10:38 ` [PATCH -next 2/4] ALSA: cs5535audio: Remove unused variable 'loop' Chen Zhongjin
@ 2022-09-30 10:38 ` Chen Zhongjin
  2022-09-30 10:38 ` [PATCH -next 4/4] ALSA: cs5535audio: Remove unused variable 'desc_addr' Chen Zhongjin
  3 siblings, 0 replies; 5+ messages in thread
From: Chen Zhongjin @ 2022-09-30 10:38 UTC (permalink / raw)
  To: linux-kernel, alsa-devel
  Cc: perex, tiwai, jayakumar.alsa, chenzhongjin, wangjianli

Reported by Clang [-Wunused-but-set-variable]

The variable 'loop_count' is introduced in this commit
'commit 719f82d3987a ("ALSA: Add support of AudioScience ASI boards")'

However, since introduced it had never been used.
Remove it for code cleaning

Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
---
 sound/pci/asihpi/hpi6000.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c
index 88d902997b74..72aa135d69f8 100644
--- a/sound/pci/asihpi/hpi6000.c
+++ b/sound/pci/asihpi/hpi6000.c
@@ -1253,7 +1253,6 @@ static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao,
 	int local_count = count;
 	int xfer_size;
 	u32 *pdata = dest;
-	u32 loop_count = 0;
 
 	while (local_count) {
 		if (local_count > c6711_burst_size)
@@ -1273,7 +1272,6 @@ static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao,
 		pdata += xfer_size;
 		local_hpi_address += sizeof(u32) * xfer_size;
 		local_count -= xfer_size;
-		loop_count++;
 	}
 
 	if (time_out)
-- 
2.17.1


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

* [PATCH -next 4/4] ALSA: cs5535audio: Remove unused variable 'desc_addr'
  2022-09-30 10:38 [PATCH 0/4] ALSA: Minor cleanup for unused variables Chen Zhongjin
                   ` (2 preceding siblings ...)
  2022-09-30 10:38 ` [PATCH -next 3/4] ALSA: cs5535audio: Remove unused variable 'loop_count' Chen Zhongjin
@ 2022-09-30 10:38 ` Chen Zhongjin
  3 siblings, 0 replies; 5+ messages in thread
From: Chen Zhongjin @ 2022-09-30 10:38 UTC (permalink / raw)
  To: linux-kernel, alsa-devel
  Cc: perex, tiwai, jayakumar.alsa, chenzhongjin, wangjianli

Reported by Clang [-Wunused-but-set-variable]

The variable 'desc_addr' is introduced in this commit
'commit 9b4ffa48ae85 ("[ALSA] Add support for the CS5535 Audio device")'

However, since introduced it was just iterated and never been used.
Remove it for code cleaning.

Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
---
 sound/pci/cs5535audio/cs5535audio_pcm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c
index 0db24cc4d916..9c88e99e3750 100644
--- a/sound/pci/cs5535audio/cs5535audio_pcm.c
+++ b/sound/pci/cs5535audio/cs5535audio_pcm.c
@@ -110,7 +110,7 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au,
 					 unsigned int period_bytes)
 {
 	unsigned int i;
-	u32 addr, desc_addr, jmpprd_addr;
+	u32 addr, jmpprd_addr;
 	struct cs5535audio_dma_desc *lastdesc;
 
 	if (periods > CS5535AUDIO_MAX_DESCRIPTORS)
@@ -131,14 +131,12 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au,
 	/* the u32 cast is okay because in snd*create we successfully told
 	   pci alloc that we're only 32 bit capable so the upper will be 0 */
 	addr = (u32) substream->runtime->dma_addr;
-	desc_addr = (u32) dma->desc_buf.addr;
 	for (i = 0; i < periods; i++) {
 		struct cs5535audio_dma_desc *desc =
 			&((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i];
 		desc->addr = cpu_to_le32(addr);
 		desc->size = cpu_to_le16(period_bytes);
 		desc->ctlreserved = cpu_to_le16(PRD_EOP);
-		desc_addr += sizeof(struct cs5535audio_dma_desc);
 		addr += period_bytes;
 	}
 	/* we reserved one dummy descriptor at the end to do the PRD jump */
-- 
2.17.1


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

end of thread, other threads:[~2022-09-30 11:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-30 10:38 [PATCH 0/4] ALSA: Minor cleanup for unused variables Chen Zhongjin
2022-09-30 10:38 ` [PATCH -next 1/4] ALSA: rawmidi: Remove unused variable 'dest_frames' Chen Zhongjin
2022-09-30 10:38 ` [PATCH -next 2/4] ALSA: cs5535audio: Remove unused variable 'loop' Chen Zhongjin
2022-09-30 10:38 ` [PATCH -next 3/4] ALSA: cs5535audio: Remove unused variable 'loop_count' Chen Zhongjin
2022-09-30 10:38 ` [PATCH -next 4/4] ALSA: cs5535audio: Remove unused variable 'desc_addr' Chen Zhongjin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).