[ It's not immediately clear to me that we intended to drop the lock if
  someone else is holding it.  If so maybe this should have a comment?
  -dan ]


tree:   git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-unstable.git 
master
head:   33a8b5de23c78c47e2e0791118e836e75f3e175a
commit: 32f5bd4b2e7724019b2330358e0f0e05b2ed8e79 [15036/15056] ALSA: pcm: Allow 
nonatomic trigger operations

New smatch warnings:
sound/core/pcm_native.c:806 snd_pcm_action_mutex() error: double unlock 
'mutex:&substream->self_group.mutex'

git remote add sound-unstable 
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-unstable.git
git remote update sound-unstable
git checkout 32f5bd4b2e7724019b2330358e0f0e05b2ed8e79
vim +806 sound/core/pcm_native.c

^1da177e Linus Torvalds 2005-04-16  790         if (res == 0)
^1da177e Linus Torvalds 2005-04-16  791                 
ops->post_action(substream, state);
^1da177e Linus Torvalds 2005-04-16  792         else if (ops->undo_action)
^1da177e Linus Torvalds 2005-04-16  793                 
ops->undo_action(substream, state);
^1da177e Linus Torvalds 2005-04-16  794         return res;
^1da177e Linus Torvalds 2005-04-16  795  }
^1da177e Linus Torvalds 2005-04-16  796  
32f5bd4b Takashi Iwai   2014-08-29  797  /* call in mutex-protected context */
32f5bd4b Takashi Iwai   2014-08-29  798  static int snd_pcm_action_mutex(struct 
action_ops *ops,
32f5bd4b Takashi Iwai   2014-08-29  799                                 struct 
snd_pcm_substream *substream,
32f5bd4b Takashi Iwai   2014-08-29  800                                 int 
state)
32f5bd4b Takashi Iwai   2014-08-29  801  {
32f5bd4b Takashi Iwai   2014-08-29  802         int res;
32f5bd4b Takashi Iwai   2014-08-29  803  
32f5bd4b Takashi Iwai   2014-08-29  804         if 
(snd_pcm_stream_linked(substream)) {
32f5bd4b Takashi Iwai   2014-08-29  805                 if 
(!mutex_trylock(&substream->self_group.mutex)) {
32f5bd4b Takashi Iwai   2014-08-29 @806                         
mutex_unlock(&substream->self_group.mutex);
32f5bd4b Takashi Iwai   2014-08-29  807                         
mutex_lock(&substream->group->mutex);
32f5bd4b Takashi Iwai   2014-08-29  808                         
mutex_lock(&substream->self_group.mutex);
32f5bd4b Takashi Iwai   2014-08-29  809                 }
32f5bd4b Takashi Iwai   2014-08-29  810                 res = 
snd_pcm_action_group(ops, substream, state, 1);
32f5bd4b Takashi Iwai   2014-08-29  811                 
mutex_unlock(&substream->group->mutex);
32f5bd4b Takashi Iwai   2014-08-29  812         } else {
32f5bd4b Takashi Iwai   2014-08-29  813                 res = 
snd_pcm_action_single(ops, substream, state);
32f5bd4b Takashi Iwai   2014-08-29  814         }

---
0-DAY kernel build testing backend              Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild                 Intel Corporation
_______________________________________________
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild

Reply via email to