All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Bo <wubo40@huawei.com>
To: <perex@perex.cz>, <tiwai@suse.com>, <libin.yang@linux.intel.com>,
	<kai.vehmanen@linux.intel.com>, <nmahale@nvidia.com>,
	<aplattner@nvidia.com>, <pierre-louis.bossart@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, <alsa-devel@alsa-project.org>,
	<liuzhiqiang26@huawei.com>, <linfeilong@huawei.com>,
	<wubo40@huawei.com>
Subject: [PATCH] sound:hdmi:fix without unlocked before return
Date: Sun, 26 Apr 2020 21:17:22 +0800	[thread overview]
Message-ID: <1587907042-694161-1-git-send-email-wubo40@huawei.com> (raw)

Fix the following coccicheck warning:
sound/pci/hda/patch_hdmi.c:1852:2-8: preceding lock on line 1846

After add sanity check to pass klockwork check,
The spdif_mutex should be unlock before return true
in check_non_pcm_per_cvt().

Signed-off-by: Wu Bo <wubo40@huawei.com>
---
 sound/pci/hda/patch_hdmi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 4eff1605..c24832b 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1848,8 +1848,10 @@ 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))
+	if (WARN_ON(spdif == NULL)) {
+		mutex_unlock(&codec->spdif_mutex);
 		return true;
+	}
 	non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
 	mutex_unlock(&codec->spdif_mutex);
 	return non_pcm;
-- 
1.8.3.1


WARNING: multiple messages have this Message-ID (diff)
From: Wu Bo <wubo40@huawei.com>
To: <perex@perex.cz>, <tiwai@suse.com>, <libin.yang@linux.intel.com>,
	<kai.vehmanen@linux.intel.com>, <nmahale@nvidia.com>,
	<aplattner@nvidia.com>,  <pierre-louis.bossart@linux.intel.com>
Cc: linfeilong@huawei.com, wubo40@huawei.com,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	liuzhiqiang26@huawei.com
Subject: [PATCH] sound:hdmi:fix without unlocked before return
Date: Sun, 26 Apr 2020 21:17:22 +0800	[thread overview]
Message-ID: <1587907042-694161-1-git-send-email-wubo40@huawei.com> (raw)

Fix the following coccicheck warning:
sound/pci/hda/patch_hdmi.c:1852:2-8: preceding lock on line 1846

After add sanity check to pass klockwork check,
The spdif_mutex should be unlock before return true
in check_non_pcm_per_cvt().

Signed-off-by: Wu Bo <wubo40@huawei.com>
---
 sound/pci/hda/patch_hdmi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 4eff1605..c24832b 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1848,8 +1848,10 @@ 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))
+	if (WARN_ON(spdif == NULL)) {
+		mutex_unlock(&codec->spdif_mutex);
 		return true;
+	}
 	non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
 	mutex_unlock(&codec->spdif_mutex);
 	return non_pcm;
-- 
1.8.3.1


             reply	other threads:[~2020-04-26 13:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26 13:17 Wu Bo [this message]
2020-04-26 13:17 ` [PATCH] sound:hdmi:fix without unlocked before return Wu Bo
2020-04-29  7:27 ` Takashi Iwai
2020-04-29  7:27   ` Takashi Iwai
2020-04-30  4:37   ` Wu Bo
2020-04-30  4:37     ` Wu Bo
2020-04-26 17:00 Markus Elfring
2020-04-26 17:00 ` Markus Elfring
2020-04-26 17:00 ` Markus Elfring

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=1587907042-694161-1-git-send-email-wubo40@huawei.com \
    --to=wubo40@huawei.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=aplattner@nvidia.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=libin.yang@linux.intel.com \
    --cc=linfeilong@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuzhiqiang26@huawei.com \
    --cc=nmahale@nvidia.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.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.