From: Markus Elfring <Markus.Elfring@web.de>
To: kernel-janitors@vger.kernel.org, alsa-devel@alsa-project.org,
sound-open-firmware@alsa-project.org,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Daniel Baluta <daniel.baluta@nxp.com>,
Jaroslav Kysela <perex@perex.cz>,
Jyri Sarha <jyri.sarha@linux.intel.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Rander Wang <rander.wang@intel.com>,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
cocci@inria.fr, Dan Carpenter <error27@gmail.com>
Subject: [cocci] [PATCH] ASoC: SOF: ipc4-topology: Improve unlocking of a mutex in sof_ipc4_widget_free()
Date: Sat, 10 Jun 2023 13:36:37 +0200 [thread overview]
Message-ID: <3a7476b6-2ae9-494e-1840-0915ddf47c2f@web.de> (raw)
In-Reply-To: <20230322181830.574635-1-jyri.sarha@linux.intel.com>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 10 Jun 2023 12:40:09 +0200
Add a jump target so that a call of the function “mutex_unlock”
is stored only once in this function implementation.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
sound/soc/sof/ipc4-topology.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index a4e1a70b607d..f0fd1dfa384e 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -2300,8 +2300,7 @@ static int sof_ipc4_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget
if (pipeline->use_chain_dma) {
dev_warn(sdev->dev, "use_chain_dma set for scheduler %s",
swidget->widget->name);
- mutex_unlock(&ipc4_data->pipeline_state_mutex);
- return 0;
+ goto unlock;
}
header = SOF_IPC4_GLB_PIPE_INSTANCE_ID(swidget->instance_id);
@@ -2326,7 +2325,7 @@ static int sof_ipc4_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget
if (!pipeline->use_chain_dma)
ida_free(&fw_module->m_ida, swidget->instance_id);
}
-
+unlock:
mutex_unlock(&ipc4_data->pipeline_state_mutex);
return ret;
--
2.41.0
parent reply other threads:[~2023-06-10 11:37 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20230322181830.574635-1-jyri.sarha@linux.intel.com>]
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=3a7476b6-2ae9-494e-1840-0915ddf47c2f@web.de \
--to=markus.elfring@web.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=cocci@inria.fr \
--cc=daniel.baluta@nxp.com \
--cc=error27@gmail.com \
--cc=jyri.sarha@linux.intel.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=rander.wang@intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sound-open-firmware@alsa-project.org \
--cc=yung-chuan.liao@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).