diff mbox

ALSA: hda: fix a locking bug in dead code

Message ID 20170421205555.vjzh3idi2nv3y5k3@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter April 21, 2017, 8:55 p.m. UTC
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 mbox

Patch

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;
 }