From: Markus Elfring <Markus.Elfring@web.de>
To: Wu Bo <wubo40@huawei.com>, alsa-devel@alsa-project.org
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Aaron Plattner <aplattner@nvidia.com>,
Feilong Lin <linfeilong@huawei.com>,
Jaroslav Kysela <perex@perex.cz>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Libin Yang <libin.yang@linux.intel.com>,
Nikhil Mahale <nmahale@nvidia.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Takashi Iwai <tiwai@suse.com>,
Zhiqiang Liu <liuzhiqiang26@huawei.com>
Subject: Re: [PATCH] sound:hdmi:fix without unlocked before return
Date: Sun, 26 Apr 2020 19:00:54 +0200 [thread overview]
Message-ID: <475cb7a9-0992-3a79-a0ad-d3f8922ba3cb@web.de> (raw)
> After add sanity check to pass klockwork check,
> The spdif_mutex should be unlock before return true
> in check_non_pcm_per_cvt().
How do you think about a wording variant like the following?
Subject:
[PATCH v2] ALSA: hda/hdmi: Unlock a mutex always before returning from check_non_pcm_per_cvt()
Change description (according to a solution alternative):
The exception handling was incomplete in an if branch for
a null pointer check of the variable “spdif”.
Thus assign an appropriate value to the local variable “non_pcm”
by using a conditional operator instead.
A mutex is also appropriately unlocked then.
…
> +++ 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)
…
> - if (WARN_ON(spdif == NULL))
> + if (WARN_ON(spdif == NULL)) {
> + mutex_unlock(&codec->spdif_mutex);
> return true;
> + }
> non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
- if (WARN_ON(spdif == NULL))
- return true;
- non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO);
+ non_pcm = WARN_ON(!spdif)
+ ? true
+ : !!(spdif->status & IEC958_AES0_NONAUDIO);
mutex_unlock(&codec->spdif_mutex);
return non_pcm;
}
Would you like to add the tag “Fixes” to the change description?
Regards,
Markus
next reply other threads:[~2020-04-26 17:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-26 17:00 Markus Elfring [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-04-26 13:17 Wu Bo
2020-04-29 7:27 ` Takashi Iwai
2020-04-30 4:37 ` Wu Bo
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=475cb7a9-0992-3a79-a0ad-d3f8922ba3cb@web.de \
--to=markus.elfring@web.de \
--cc=alsa-devel@alsa-project.org \
--cc=aplattner@nvidia.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=kernel-janitors@vger.kernel.org \
--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 \
--cc=wubo40@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®