All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jaroslav Kysela <perex@perex.cz>,
	Libin Yang <libin.yang@linux.intel.com>
Cc: "Ander Conselvan De Oliveira"
	<ander.conselvan.de.oliveira@intel.com>,
	alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org,
	"Takashi Iwai" <tiwai@suse.com>,
	"Hui Wang" <hui.wang@canonical.com>,
	"Pandiyan, Dhinakaran" <dhinakaran.pandiyan@intel.com>,
	"Senthilnathan Veppur" <senthilnathanx.veppur@intel.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Subject: [PATCH] ALSA: hda: fix a locking bug in dead code
Date: Fri, 21 Apr 2017 20:55:56 +0000	[thread overview]
Message-ID: <20170421205555.vjzh3idi2nv3y5k3@mwanda> (raw)

We added an impossible return to silence a static checker warning but it
introduced another warning because we need to drop the lock before
returning.

Fixes: 960a581e22d9 ("ALSA: hda: fix some klockwork scan warnings")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 90e4ff87445e..0dc18c4a3b1b 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1808,9 +1808,12 @@ static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)
 	/* Add sanity check to pass klockwork check.
 	 * This should never happen.
 	 */
-	if (WARN_ON(spdif = NULL))
-		return true;
+	if (WARN_ON(spdif = NULL)) {
+		non_pcm = true;
+		goto unlock;
+	}
 	non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
+unlock:
 	mutex_unlock(&codec->spdif_mutex);
 	return non_pcm;
 }

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jaroslav Kysela <perex@perex.cz>,
	Libin Yang <libin.yang@linux.intel.com>
Cc: "Ander Conselvan De Oliveira"
	<ander.conselvan.de.oliveira@intel.com>,
	alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org,
	"Takashi Iwai" <tiwai@suse.com>,
	"Hui Wang" <hui.wang@canonical.com>,
	"Pandiyan, Dhinakaran" <dhinakaran.pandiyan@intel.com>,
	"Senthilnathan Veppur" <senthilnathanx.veppur@intel.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Subject: [PATCH] ALSA: hda: fix a locking bug in dead code
Date: Fri, 21 Apr 2017 23:55:56 +0300	[thread overview]
Message-ID: <20170421205555.vjzh3idi2nv3y5k3@mwanda> (raw)

We added an impossible return to silence a static checker warning but it
introduced another warning because we need to drop the lock before
returning.

Fixes: 960a581e22d9 ("ALSA: hda: fix some klockwork scan warnings")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 90e4ff87445e..0dc18c4a3b1b 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1808,9 +1808,12 @@ static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)
 	/* Add sanity check to pass klockwork check.
 	 * This should never happen.
 	 */
-	if (WARN_ON(spdif == NULL))
-		return true;
+	if (WARN_ON(spdif == NULL)) {
+		non_pcm = true;
+		goto unlock;
+	}
 	non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
+unlock:
 	mutex_unlock(&codec->spdif_mutex);
 	return non_pcm;
 }

             reply	other threads:[~2017-04-21 20:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21 20:55 Dan Carpenter [this message]
2017-04-21 20:55 ` [PATCH] ALSA: hda: fix a locking bug in dead code Dan Carpenter

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=20170421205555.vjzh3idi2nv3y5k3@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=ander.conselvan.de.oliveira@intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=hui.wang@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=libin.yang@linux.intel.com \
    --cc=perex@perex.cz \
    --cc=senthilnathanx.veppur@intel.com \
    --cc=tiwai@suse.com \
    --cc=ville.syrjala@linux.intel.com \
    /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.