lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 12 Jun 2023 11:58:02 -0500
From:   Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To:     Markus Elfring <Markus.Elfring@....de>,
        kernel-janitors@...r.kernel.org, alsa-devel@...a-project.org,
        sound-open-firmware@...a-project.org,
        Bard Liao <yung-chuan.liao@...ux.intel.com>,
        Daniel Baluta <daniel.baluta@....com>,
        Jaroslav Kysela <perex@...ex.cz>,
        Jyri Sarha <jyri.sarha@...ux.intel.com>,
        Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>,
        Rander Wang <rander.wang@...el.com>,
        Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>
Cc:     LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr,
        Dan Carpenter <error27@...il.com>
Subject: Re: [PATCH] ASoC: SOF: ipc4-topology: Improve unlocking of a mutex in
 sof_ipc4_widget_free()



On 6/10/23 06:36, Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.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@...rs.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;

The change looks good but I am wondering if we need to print a dev_warn
log which is already done on the sof_ipc4_widget_setup() path.

This seems redundant. Ranjani, can we simplify?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ