sound/core/seq: remove dead code
PATCH 1/1 sound/core/seq: remove dead code
The function snd_seq_queue_client_termination() is only called from function seq_free_client1(). The seq_free_client1() calls function snd_seq_queue_client_leave(), which deletes all objects whose owner equals to client->number in global array queue_list, before the function snd_seq_queue_client_termination(), which checks whether there are any objects in global array queue_list whose owner equals to client->number, with the same argument client->number. So the checking code in function snd_seq_queue_client_termination() is dead code. Remove those dead code.
--- sound/core/seq/seq_queue.c | 11 ----------- 1 file changed, 11 deletions(-)
sound/core/seq/seq_queue.c +0 -11
@@ -545,21 +545,10 @@ void snd_seq_queue_client_termination(int client)unsigned long flags;int i;struct snd_seq_queue *q; -bool matched;for (i =0 ; i <SNDRV_SEQ_MAX_QUEUES ; i++) {if ((q =queueptr (i)) ==NULL )continue ; -spin_lock_irqsave (&q->owner_lock, flags); - matched = (q->owner == client); -if (matched) - q->klocked =1 ; -spin_unlock_irqrestore (&q->owner_lock, flags); -if (matched) { -if (q->timer->running) -snd_seq_timer_stop (q->timer); -snd_seq_timer_reset (q->timer); - }queuefree (q); } }
Signature · 1 line
2.17.1
Hi Yu,
url: https://github.com/0day-ci/linux/commits/Yu-Hao/sound-core-seq-remove-dead-code/20201102-152326 base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next compiler: sparc64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
Quoted 1 line
Quoted 1 line
sound/core/seq/seq_queue.c:545:16: warning: Unused variable: flags [unusedVariable]
unsigned long flags;
^vim +545 sound/core/seq/seq_queue.c
^1da177e4c3f415 Linus Torvalds 2005-04-16 543 void snd_seq_queue_client_termination(int client)
^1da177e4c3f415 Linus Torvalds 2005-04-16 544 {
^1da177e4c3f415 Linus Torvalds 2005-04-16 @545 unsigned long flags;
^^^^^^^^^^^^^^^^^^^Unused.
^1da177e4c3f415 Linus Torvalds 2005-04-16 546 int i;
c7e0b5bf9fff1b7 Takashi Iwai 2005-11-17 547 struct snd_seq_queue *q;
^1da177e4c3f415 Linus Torvalds 2005-04-16 548
^1da177e4c3f415 Linus Torvalds 2005-04-16 549 for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) {
^1da177e4c3f415 Linus Torvalds 2005-04-16 550 if ((q = queueptr(i)) == NULL)
^1da177e4c3f415 Linus Torvalds 2005-04-16 551 continue;
^1da177e4c3f415 Linus Torvalds 2005-04-16 552 queuefree(q);
^1da177e4c3f415 Linus Torvalds 2005-04-16 553 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 554 }---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to [email protected]
Quoted 11 lines · Yu Hao
The function
snd_seq_queue_client_termination()is only called from functionseq_free_client1(). Theseq_free_client1()calls functionsnd_seq_queue_client_leave(), which deletes all objects whose owner equals toclient->numberin global arrayqueue_list, before the functionsnd_seq_queue_client_termination(), which checks whether there are any objects in global arrayqueue_listwhose owner equals toclient->number, with the same argumentclient->number. So the checking code in functionsnd_seq_queue_client_termination()is dead code. Remove those dead code.
Quoted 1 line
Signed-off-by Yu Hao <[email protected]>
Actually the whole function snd_seq_queue_client_termination() can be removed. It's a quite old code and I don't remember clearly, but I guess the intention was to call this before the actual queue deletion. OTOH, it doesn't make any sense to change that order any longer, as the snd_seq_queue_client_leave() already takes similar procedure anyway, so let's rather wipe off the useless function.
Could you resubmit with that change?
thanks,
Takashi
Quoted 33 lines
--- sound/core/seq/seq_queue.c | 11 ----------- 1 file changed, 11 deletions(-)sound/core/seq/seq_queue.c +0
-11@@ -545,21 +545,10 @@ void snd_seq_queue_client_termination(int client)unsigned long flags;int i;struct snd_seq_queue *q; -bool matched;for (i =0 ; i <SNDRV_SEQ_MAX_QUEUES ; i++) {if ((q =queueptr (i)) ==NULL )continue ; -spin_lock_irqsave (&q->owner_lock, flags); - matched = (q->owner == client); -if (matched) - q->klocked =1 ; -spin_unlock_irqrestore (&q->owner_lock, flags); -if (matched) { -if (q->timer->running) -snd_seq_timer_stop (q->timer); -snd_seq_timer_reset (q->timer); - }queuefree (q); } }Signature · 1 line
2.17.1
Yes, I can do that.
And a quick question, to resubmit with that change means that I should create a new submission and this one ends, right?
Thanks.
Quoted 63 lines · Takashi Iwai
Quoted 11 lines · Yu Hao
The function
snd_seq_queue_client_termination()is only called from functionseq_free_client1(). Theseq_free_client1()calls functionsnd_seq_queue_client_leave(), which deletes all objects whose owner equals toclient->numberin global arrayqueue_list, before the functionsnd_seq_queue_client_termination(), which checks whether there are any objects in global arrayqueue_listwhose owner equals toclient->number, with the same argumentclient->number. So the checking code in functionsnd_seq_queue_client_termination()is dead code. Remove those dead code.Quoted 1 line
Signed-off-by Yu Hao <[email protected]>Actually the whole function
snd_seq_queue_client_termination()can be removed. It's a quite old code and I don't remember clearly, but I guess the intention was to call this before the actual queue deletion. OTOH, it doesn't make any sense to change that order any longer, as thesnd_seq_queue_client_leave()already takes similar procedure anyway, so let's rather wipe off the useless function.Could you resubmit with that change?
thanks,
Takashi
Quoted 33 lines
--- sound/core/seq/seq_queue.c | 11 ----------- 1 file changed, 11 deletions(-)sound/core/seq/seq_queue.c +0
-12@@ -545,21 +545,10 @@ void snd_seq_queue_client_termination(int client)unsigned long flags;int i;struct snd_seq_queue *q; -bool matched;for (i =0 ; i <SNDRV_SEQ_MAX_QUEUES ; i++) {if ((q =queueptr (i)) ==NULL )continue ; -spin_lock_irqsave (&q->owner_lock, flags); - matched = (q->owner == client); -if (matched) - q->klocked =1 ; -spin_unlock_irqrestore (&q->owner_lock, flags); -if (matched) { -if (q->timer->running) -snd_seq_timer_stop (q->timer); -snd_seq_timer_reset (q->timer); - }queuefree (q); } } --2.17.1
Quoted 5 lines · Yu Hao
Yes, I can do that.
And a quick question, to resubmit with that change means that I should create a new submission and this one ends, right?
Yes, just submit a fresh patch.
thanks,
Takashi
Quoted 68 lines
Thanks.
On Tue, Nov 3, 2020 at 5:09 AM Takashi Iwai <[email protected]> wrote:
On Mon, 02 Nov 2020 08:11:54 +0100, Yu Hao wrote: > > The function snd_seq_queue_client_termination() is only called from > function seq_free_client1(). The seq_free_client1() calls function > snd_seq_queue_client_leave(), which deletes all objects whose owner > equals to client->number in global array queue_list, before the function > snd_seq_queue_client_termination(), which checks whether there are > any objects in global array queue_list whose owner equals to > client->number, with the same argument client->number. So > the checking code in function snd_seq_queue_client_termination() is > dead code. Remove those dead code. > > Signed-off-by: Yu Hao <[email protected]> Actually the whole function snd_seq_queue_client_termination() can be removed. It's a quite old code and I don't remember clearly, but I guess the intention was to call this before the actual queue deletion. OTOH, it doesn't make any sense to change that order any longer, as the snd_seq_queue_client_leave() already takes similar procedure anyway, so let's rather wipe off the useless function. Could you resubmit with that change? thanks, Takashi > --- > sound/core/seq/seq_queue.c | 11 ----------- > 1 file changed, 11 deletions(-) > > diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c > index 71a6ea62c3be..91b3f3295d0b 100644 > --- a/sound/core/seq/seq_queue.c > +++ b/sound/core/seq/seq_queue.c > @@ -545,21 +545,10 @@ void snd_seq_queue_client_termination(int client) > unsigned long flags; > int i; > struct snd_seq_queue *q; > - bool matched; > > for (i = 0; i < SNDRV_SEQ_MAX_QUEUES; i++) { > if ((q = queueptr(i)) == NULL) > continue; > - spin_lock_irqsave(&q->owner_lock, flags); > - matched = (q->owner == client); > - if (matched) > - q->klocked = 1; > - spin_unlock_irqrestore(&q->owner_lock, flags); > - if (matched) { > - if (q->timer->running) > - snd_seq_timer_stop(q->timer); > - snd_seq_timer_reset(q->timer); > - } > queuefree(q); > } > } > -- > 2.17.1 >