Skip to contentSkip to conversation

sound:hdmi:fix without unlocked before return

PATCH In review Wu Bo 2 participants 3 messages Apr 26, 2020 – Apr 30, 2020 Sound

lore
Share & tools
lore

Wu Bo

author
#0 lore raw

PATCH 1/1 sound:hdmi:fix without unlocked before return

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().

---
 sound/pci/hda/patch_hdmi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/pci/hda/patch_hdmi.c +3 -1
index 4eff1605..c24832b 100644
@@ -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;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 9 lines · Wu Bo

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().

Applied now with the correction of subject and Fixes tag as well as Cc-to-stable tag.

thanks,

Takashi

author
#2 lore raw
Quoted 16 lines · Takashi Iwai
Quoted 9 lines · Wu Bo

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().

Applied now with the correction of subject and Fixes tag as well as Cc-to-stable tag.

Quoted 6 lines

thanks,

Takashi

.

Thank you, I am sorry to forget to modify the V2 Patch version in time.

thanks,
Wu Bo