All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: tiwai@suse.de
Cc: alsa-devel@alsa-project.org
Subject: [bug report] ALSA: pcm: Return -EBUSY for OSS ioctls changing busy streams
Date: Tue, 27 Mar 2018 15:27:30 +0300	[thread overview]
Message-ID: <20180327122730.GA28142@mwanda> (raw)

Hello Takashi Iwai,

The patch 40cab6e88cb0: "ALSA: pcm: Return -EBUSY for OSS ioctls
changing busy streams" from Mar 23, 2018, leads to the following
static checker warning:

	sound/core/oss/pcm_oss.c:1741 snd_pcm_oss_set_rate()
	warn: inconsistent returns 'mutex:&runtime->oss.params_lock'.
	  Locked on:   line 1734
	  Unlocked on: line 1732
	               line 1741

sound/core/oss/pcm_oss.c
  1717  static int snd_pcm_oss_set_rate(struct snd_pcm_oss_file *pcm_oss_file, int rate)
  1718  {
  1719          int idx;
  1720  
  1721          for (idx = 1; idx >= 0; --idx) {
  1722                  struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];
  1723                  struct snd_pcm_runtime *runtime;
  1724                  if (substream == NULL)
  1725                          continue;
  1726                  runtime = substream->runtime;
  1727                  if (rate < 1000)
  1728                          rate = 1000;
  1729                  else if (rate > 192000)
  1730                          rate = 192000;
  1731                  if (mutex_lock_interruptible(&runtime->oss.params_lock))
  1732                          return -ERESTARTSYS;
  1733                  if (atomic_read(&runtime->oss.rw_ref))
  1734                          return -EBUSY;
                                ^^^^^^^^^^^^^
Unlock before returning?

  1735                  if (runtime->oss.rate != rate) {
  1736                          runtime->oss.params = 1;
  1737                          runtime->oss.rate = rate;
  1738                  }
  1739                  mutex_unlock(&runtime->oss.params_lock);
  1740          }
  1741          return snd_pcm_oss_get_rate(pcm_oss_file);
  1742  }

regards,
dan carpenter

             reply	other threads:[~2018-03-27 12:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27 12:27 Dan Carpenter [this message]
2018-03-27 12:35 ` [bug report] ALSA: pcm: Return -EBUSY for OSS ioctls changing busy streams Takashi Iwai
2018-03-27 14:23   ` Takashi Iwai

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=20180327122730.GA28142@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.