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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6f0301dd-ce1f-084a-f29b-27bf897804de@linux.intel.com>
Date:   Thu, 26 Jan 2023 09:54:03 +0200
From:   Péter Ujfalusi <peter.ujfalusi@...ux.intel.com>
To:     Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
        Venkata Prasad Potturu <venkataprasad.potturu@....com>,
        broonie@...nel.org, alsa-devel@...a-project.org
Cc:     Sunil-kumar.Dommati@....com, ssabakar@....com,
        Ajit Kumar Pandey <AjitKumar.Pandey@....com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Basavaraj.Hiregoudar@....com, Takashi Iwai <tiwai@...e.com>,
        open list <linux-kernel@...r.kernel.org>,
        Jia-Ju Bai <baijiaju1990@...il.com>,
        Mario Limonciello <mario.limonciello@....com>,
        Akihiko Odaki <akihiko.odaki@...il.com>,
        Vijendar.Mukunda@....com,
        V sujith kumar Reddy <Vsujithkumar.Reddy@....com>
Subject: Re: [PATCH v2 3/5] ASoC: amd: acp: Refactor i2s clocks programming
 sequence



On 25/01/2023 19:15, Pierre-Louis Bossart wrote:
> This patch adds new Sparse warnings [1]:
> 
> sound/soc/amd/acp/acp-mach-common.c:189:35: error: restricted
> snd_pcm_format_t degrades to integer
> sound/soc/amd/acp/acp-mach-common.c:333:35: error: restricted
> snd_pcm_format_t degrades to integer
> sound/soc/amd/acp/acp-mach-common.c:478:35: error: restricted
> snd_pcm_format_t degrades to integer
> sound/soc/amd/acp/acp-mach-common.c:619:35: error: restricted
> snd_pcm_format_t degrades to integer
> 
>> @@ -193,7 +163,11 @@ static int acp_card_rt5682_hw_params(struct snd_pcm_substream *substream,
>>  	struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
>>  	struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
>>  	int ret;
>> -	unsigned int fmt;
>> +	unsigned int fmt, srate, ch, format;
>> +
>> +	srate = params_rate(params);
>> +	ch = params_channels(params);
>> +	format = 8 * params_format(params);
> 
> This last line looks suspicious, no? format-to-physical-size conversions
> should be using existing macros.

not only that, but the "8 * params_format(params)" is certainly not
correct for the purpose.

params_format() returns SNDRV_PCM_FORMAT_*, which is basically an enum:
SNDRV_PCM_FORMAT_S8		0
SNDRV_PCM_FORMAT_S16_LE		2
SNDRV_PCM_FORMAT_S24_LE		6
SNDRV_PCM_FORMAT_S24_3LE	32
SNDRV_PCM_FORMAT_S32_LE		10

include/uapi/sound/asound.h

> Should it be
> 
> format = params_physical_width(params);

I believe this was the intention.

> 
> ?
> 
> 
>> +	/* Set tdm/i2s1 master bclk ratio */
>> +	ret = snd_soc_dai_set_bclk_ratio(codec_dai, ch * format);
>> +	if (ret < 0) {
>> +		dev_err(rtd->dev, "Failed to set rt5682 tdm bclk ratio: %d\n", ret);
>> +		return ret;
>> +	}
>> +
>> +	if (!drvdata->soc_mclk) {
>> +		ret = acp_clk_enable(drvdata, srate, ch * format);
>> +		if (ret < 0) {
>> +			dev_err(rtd->card->dev, "Failed to enable HS clk: %d\n", ret);
>> +			return ret;
>> +		}
> 
> [1]
> https://github.com/thesofproject/linux/actions/runs/4005001249/jobs/6874834205

-- 
Péter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ