* [PATCH v4] ASoC: SOF: sof-audio: pcm_id is __le32
@ 2026-03-18 16:48 Ben Dooks
2026-03-18 17:38 ` Mark Brown
2026-03-24 19:48 ` Mark Brown
0 siblings, 2 replies; 5+ messages in thread
From: Ben Dooks @ 2026-03-18 16:48 UTC (permalink / raw)
To: peter.ujfalusi, yung-chuan.liao, ranjani.sridharan,
daniel.baluta, lgirdwood, broonie, linux-sound
Cc: kai.vehmanen, pierre-louis.bossart, perex, tiwai, linux-kernel,
Ben Dooks
The pcm_id value is __le32 so convert it before passing to the dev_dbg
function to be printed. Also fixup some other uses of __le32 data and
a couple of places where %u should have been used instead of %d
Picked up by sparse prototype for variadic and printf
function checking. Fixes a large number of sparse warnings, such as:
sound/soc/sof/pcm.c:84:25: warning: incorrect type in argument 4 (different base types)
sound/soc/sof/pcm.c:84:25: expected unsigned int
sound/soc/sof/pcm.c:84:25: got restricted __le32 [usertype] pcm_id
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
v2: fix missing __le32 conversions
v3: further __le32 fixes for other header values
v4: fix signed-ness of printf formatting
---
sound/soc/sof/compress.c | 4 ++--
sound/soc/sof/ipc4-topology.c | 13 +++++++------
sound/soc/sof/pcm.c | 6 +++---
sound/soc/sof/sof-audio.h | 11 +++++++----
sound/soc/sof/topology.c | 22 ++++++++++++----------
5 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/sound/soc/sof/compress.c b/sound/soc/sof/compress.c
index 96570121aae0..3dbc05bf3b79 100644
--- a/sound/soc/sof/compress.c
+++ b/sound/soc/sof/compress.c
@@ -247,8 +247,8 @@ static int sof_compr_set_params(struct snd_soc_component *component,
ret = snd_sof_set_stream_data_offset(sdev, &spcm->stream[cstream->direction],
ipc_params_reply.posn_offset);
if (ret < 0) {
- dev_err(component->dev, "Invalid stream data offset for Compr %d\n",
- spcm->pcm.pcm_id);
+ dev_err(component->dev, "Invalid stream data offset for Compr %u\n",
+ le32_to_cpu(spcm->pcm.pcm_id));
goto out;
}
diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index db077e9d5644..82f1e44a145e 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -581,6 +581,7 @@ sof_ipc4_update_card_components_string(struct snd_sof_widget *swidget,
struct snd_soc_component *scomp = spcm->scomp;
struct snd_soc_card *card = scomp->card;
const char *pt_marker = "iec61937-pcm";
+ unsigned pcm_id = le32_to_cpu(spcm->pcm.pcm_id);
/*
* Update the card's components list with iec61937-pcm and a list of PCM
@@ -595,21 +596,21 @@ sof_ipc4_update_card_components_string(struct snd_sof_widget *swidget,
if (strstr(card->components, pt_marker))
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
- "%s,%d",
+ "%s,%u",
card->components,
- spcm->pcm.pcm_id);
+ pcm_id);
else
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
- "%s %s:%d",
+ "%s %s:%u",
card->components,
pt_marker,
- spcm->pcm.pcm_id);
+ pcm_id);
devm_kfree(card->dev, tmp);
} else {
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
- "%s:%d", pt_marker,
- spcm->pcm.pcm_id);
+ "%s:%u", pt_marker,
+ pcm_id);
}
if (!card->components)
diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
index 5b598d0940eb..fcb002b3e611 100644
--- a/sound/soc/sof/pcm.c
+++ b/sound/soc/sof/pcm.c
@@ -360,8 +360,8 @@ static int sof_pcm_prepare(struct snd_soc_component *component,
platform_params = &spcm->platform_params[substream->stream];
ret = sof_widget_list_setup(sdev, spcm, params, platform_params, dir);
if (ret < 0) {
- dev_err(sdev->dev, "failed widget list set up for pcm %d dir %d\n",
- spcm->pcm.pcm_id, dir);
+ dev_err(sdev->dev, "failed widget list set up for pcm %u dir %d\n",
+ le32_to_cpu(spcm->pcm.pcm_id), dir);
spcm->stream[dir].list = NULL;
snd_soc_dapm_dai_free_widgets(&list);
return ret;
@@ -652,7 +652,7 @@ static int sof_pcm_new(struct snd_soc_component *component,
}
dev_dbg(spcm->scomp->dev, "pcm%u (%s): Entry: pcm_construct\n",
- spcm->pcm.pcm_id, spcm->pcm.pcm_name);
+ le32_to_cpu(spcm->pcm.pcm_id), spcm->pcm.pcm_name);
/* do we need to pre-allocate playback audio buffer pages */
if (!spcm->pcm.playback)
diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h
index 36082e764bf9..80b11625915d 100644
--- a/sound/soc/sof/sof-audio.h
+++ b/sound/soc/sof/sof-audio.h
@@ -641,17 +641,20 @@ void snd_sof_pcm_init_elapsed_work(struct work_struct *work);
*/
#define spcm_dbg(__spcm, __dir, __fmt, ...) \
dev_dbg((__spcm)->scomp->dev, "pcm%u (%s), dir %d: " __fmt, \
- (__spcm)->pcm.pcm_id, (__spcm)->pcm.pcm_name, __dir, \
+ le32_to_cpu((__spcm)->pcm.pcm_id), \
+ (__spcm)->pcm.pcm_name, __dir, \
##__VA_ARGS__)
#define spcm_dbg_ratelimited(__spcm, __dir, __fmt, ...) \
dev_dbg_ratelimited((__spcm)->scomp->dev, "pcm%u (%s), dir %d: " __fmt, \
- (__spcm)->pcm.pcm_id, (__spcm)->pcm.pcm_name, __dir, \
- ##__VA_ARGS__)
+ le32_to_cpu((__spcm)->pcm.pcm_id), \
+ (__spcm)->pcm.pcm_name, __dir, \
+ ##__VA_ARGS__)
#define spcm_err(__spcm, __dir, __fmt, ...) \
dev_err((__spcm)->scomp->dev, "%s: pcm%u (%s), dir %d: " __fmt, \
- __func__, (__spcm)->pcm.pcm_id, (__spcm)->pcm.pcm_name, __dir, \
+ __func__, le32_to_cpu((__spcm)->pcm.pcm_id), \
+ (__spcm)->pcm.pcm_name, __dir, \
##__VA_ARGS__)
#if IS_ENABLED(CONFIG_SND_SOC_SOF_COMPRESS)
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 18e2401152c8..73532fad2cb9 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -775,8 +775,8 @@ static int sof_parse_token_sets(struct snd_soc_component *scomp,
array);
break;
default:
- dev_err(scomp->dev, "error: unknown token type %d\n",
- array->type);
+ dev_err(scomp->dev, "error: unknown token type %u\n",
+ le32_to_cpu(array->type));
return -EINVAL;
}
@@ -880,7 +880,7 @@ static int sof_control_load_volume(struct snd_soc_component *scomp,
ARRAY_SIZE(led_tokens), mc->priv.array,
le32_to_cpu(mc->priv.size));
if (ret != 0) {
- dev_err(scomp->dev, "error: parse led tokens failed %d\n",
+ dev_err(scomp->dev, "error: parse led tokens failed %u\n",
le32_to_cpu(mc->priv.size));
goto err;
}
@@ -970,8 +970,8 @@ static int sof_control_load(struct snd_soc_component *scomp, int index,
struct snd_sof_control *scontrol;
int ret;
- dev_dbg(scomp->dev, "tplg: load control type %d name : %s\n",
- hdr->type, hdr->name);
+ dev_dbg(scomp->dev, "tplg: load control type %u name : %s\n",
+ le32_to_cpu(hdr->type), hdr->name);
scontrol = kzalloc_obj(*scontrol);
if (!scontrol)
@@ -1015,8 +1015,10 @@ static int sof_control_load(struct snd_soc_component *scomp, int index,
case SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE:
case SND_SOC_TPLG_DAPM_CTL_PIN:
default:
- dev_warn(scomp->dev, "control type not supported %d:%d:%d\n",
- hdr->ops.get, hdr->ops.put, hdr->ops.info);
+ dev_warn(scomp->dev, "control type not supported %u:%u:%u\n",
+ le32_to_cpu(hdr->ops.get),
+ le32_to_cpu(hdr->ops.put),
+ le32_to_cpu(hdr->ops.info));
kfree(scontrol->name);
kfree(scontrol);
return 0;
@@ -1523,8 +1525,8 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
break;
case snd_soc_dapm_pga:
if (!le32_to_cpu(tw->num_kcontrols)) {
- dev_err(scomp->dev, "invalid kcontrol count %d for volume\n",
- tw->num_kcontrols);
+ dev_err(scomp->dev, "invalid kcontrol count %u for volume\n",
+ le32_to_cpu(tw->num_kcontrols));
ret = -EINVAL;
break;
}
@@ -1772,7 +1774,7 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
ARRAY_SIZE(stream_tokens), private->array,
le32_to_cpu(private->size));
if (ret) {
- dev_err(scomp->dev, "error: parse stream tokens failed %d\n",
+ dev_err(scomp->dev, "error: parse stream tokens failed %u\n",
le32_to_cpu(private->size));
return ret;
}
--
2.37.2.352.g3c44437643
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH v4] ASoC: SOF: sof-audio: pcm_id is __le32
2026-03-18 16:48 [PATCH v4] ASoC: SOF: sof-audio: pcm_id is __le32 Ben Dooks
@ 2026-03-18 17:38 ` Mark Brown
2026-03-23 12:29 ` Ben Dooks
2026-03-24 19:48 ` Mark Brown
1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2026-03-18 17:38 UTC (permalink / raw)
To: Ben Dooks
Cc: peter.ujfalusi, yung-chuan.liao, ranjani.sridharan,
daniel.baluta, lgirdwood, linux-sound, kai.vehmanen,
pierre-louis.bossart, perex, tiwai, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 459 bytes --]
On Wed, Mar 18, 2026 at 04:48:00PM +0000, Ben Dooks wrote:
> The pcm_id value is __le32 so convert it before passing to the dev_dbg
> function to be printed. Also fixup some other uses of __le32 data and
> a couple of places where %u should have been used instead of %d
>
> Picked up by sparse prototype for variadic and printf
> function checking. Fixes a large number of sparse warnings, such as:
It looks like this needs a rebase against -next.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4] ASoC: SOF: sof-audio: pcm_id is __le32
2026-03-18 17:38 ` Mark Brown
@ 2026-03-23 12:29 ` Ben Dooks
2026-03-23 14:14 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Ben Dooks @ 2026-03-23 12:29 UTC (permalink / raw)
To: Mark Brown
Cc: peter.ujfalusi, yung-chuan.liao, ranjani.sridharan,
daniel.baluta, lgirdwood, linux-sound, kai.vehmanen,
pierre-louis.bossart, perex, tiwai, linux-kernel
On 18/03/2026 17:38, Mark Brown wrote:
> On Wed, Mar 18, 2026 at 04:48:00PM +0000, Ben Dooks wrote:
>> The pcm_id value is __le32 so convert it before passing to the dev_dbg
>> function to be printed. Also fixup some other uses of __le32 data and
>> a couple of places where %u should have been used instead of %d
>>
>> Picked up by sparse prototype for variadic and printf
>> function checking. Fixes a large number of sparse warnings, such as:
>
> It looks like this needs a rebase against -next.
At this point is it worth waiting until after the next major release?
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
https://www.codethink.co.uk/privacy.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4] ASoC: SOF: sof-audio: pcm_id is __le32
2026-03-23 12:29 ` Ben Dooks
@ 2026-03-23 14:14 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2026-03-23 14:14 UTC (permalink / raw)
To: Ben Dooks
Cc: peter.ujfalusi, yung-chuan.liao, ranjani.sridharan,
daniel.baluta, lgirdwood, linux-sound, kai.vehmanen,
pierre-louis.bossart, perex, tiwai, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 307 bytes --]
On Mon, Mar 23, 2026 at 12:29:48PM +0000, Ben Dooks wrote:
> On 18/03/2026 17:38, Mark Brown wrote:
> > It looks like this needs a rebase against -next.
> At this point is it worth waiting until after the next major release?
If you like I guess, but it should be quick enough to rebase I'd have
thought?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4] ASoC: SOF: sof-audio: pcm_id is __le32
2026-03-18 16:48 [PATCH v4] ASoC: SOF: sof-audio: pcm_id is __le32 Ben Dooks
2026-03-18 17:38 ` Mark Brown
@ 2026-03-24 19:48 ` Mark Brown
1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2026-03-24 19:48 UTC (permalink / raw)
To: peter.ujfalusi, yung-chuan.liao, ranjani.sridharan,
daniel.baluta, lgirdwood, linux-sound, Ben Dooks
Cc: kai.vehmanen, pierre-louis.bossart, perex, tiwai, linux-kernel
On Wed, 18 Mar 2026 16:48:00 +0000, Ben Dooks wrote:
> The pcm_id value is __le32 so convert it before passing to the dev_dbg
> function to be printed. Also fixup some other uses of __le32 data and
> a couple of places where %u should have been used instead of %d
>
> Picked up by sparse prototype for variadic and printf
> function checking. Fixes a large number of sparse warnings, such as:
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: SOF: sof-audio: pcm_id is __le32
https://git.kernel.org/broonie/misc/c/4478886310e5
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-24 19:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-18 16:48 [PATCH v4] ASoC: SOF: sof-audio: pcm_id is __le32 Ben Dooks
2026-03-18 17:38 ` Mark Brown
2026-03-23 12:29 ` Ben Dooks
2026-03-23 14:14 ` Mark Brown
2026-03-24 19:48 ` Mark Brown
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®