Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: SOF: sof-audio: pcm_id is __le32

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>
Link: https://patch.msgid.link/20260310125106.178944-1-ben.dooks@codethink.co.uk
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Ben Dooks and committed by
Mark Brown
207fd1f4 49c00227

+23 -17
+1 -1
sound/soc/sof/compress.c
··· 248 248 ipc_params_reply.posn_offset); 249 249 if (ret < 0) { 250 250 dev_err(component->dev, "Invalid stream data offset for Compr %d\n", 251 - spcm->pcm.pcm_id); 251 + le32_to_cpu(spcm->pcm.pcm_id)); 252 252 goto out; 253 253 } 254 254
+7 -6
sound/soc/sof/ipc4-topology.c
··· 581 581 struct snd_soc_component *scomp = spcm->scomp; 582 582 struct snd_soc_card *card = scomp->card; 583 583 const char *pt_marker = "iec61937-pcm"; 584 + unsigned pcm_id = le32_to_cpu(spcm->pcm.pcm_id); 584 585 585 586 /* 586 587 * Update the card's components list with iec61937-pcm and a list of PCM ··· 596 595 597 596 if (strstr(card->components, pt_marker)) 598 597 card->components = devm_kasprintf(card->dev, GFP_KERNEL, 599 - "%s,%d", 598 + "%s,%u", 600 599 card->components, 601 - spcm->pcm.pcm_id); 600 + pcm_id); 602 601 else 603 602 card->components = devm_kasprintf(card->dev, GFP_KERNEL, 604 - "%s %s:%d", 603 + "%s %s:%u", 605 604 card->components, 606 605 pt_marker, 607 - spcm->pcm.pcm_id); 606 + pcm_id); 608 607 609 608 devm_kfree(card->dev, tmp); 610 609 } else { 611 610 card->components = devm_kasprintf(card->dev, GFP_KERNEL, 612 - "%s:%d", pt_marker, 613 - spcm->pcm.pcm_id); 611 + "%s:%u", pt_marker, 612 + pcm_id); 614 613 } 615 614 616 615 if (!card->components)
+2 -2
sound/soc/sof/pcm.c
··· 361 361 ret = sof_widget_list_setup(sdev, spcm, params, platform_params, dir); 362 362 if (ret < 0) { 363 363 dev_err(sdev->dev, "failed widget list set up for pcm %d dir %d\n", 364 - spcm->pcm.pcm_id, dir); 364 + le32_to_cpu(spcm->pcm.pcm_id), dir); 365 365 spcm->stream[dir].list = NULL; 366 366 snd_soc_dapm_dai_free_widgets(&list); 367 367 return ret; ··· 652 652 } 653 653 654 654 dev_dbg(spcm->scomp->dev, "pcm%u (%s): Entry: pcm_construct\n", 655 - spcm->pcm.pcm_id, spcm->pcm.pcm_name); 655 + le32_to_cpu(spcm->pcm.pcm_id), spcm->pcm.pcm_name); 656 656 657 657 /* do we need to pre-allocate playback audio buffer pages */ 658 658 if (!spcm->pcm.playback)
+7 -4
sound/soc/sof/sof-audio.h
··· 641 641 */ 642 642 #define spcm_dbg(__spcm, __dir, __fmt, ...) \ 643 643 dev_dbg((__spcm)->scomp->dev, "pcm%u (%s), dir %d: " __fmt, \ 644 - (__spcm)->pcm.pcm_id, (__spcm)->pcm.pcm_name, __dir, \ 644 + le32_to_cpu((__spcm)->pcm.pcm_id), \ 645 + (__spcm)->pcm.pcm_name, __dir, \ 645 646 ##__VA_ARGS__) 646 647 647 648 #define spcm_dbg_ratelimited(__spcm, __dir, __fmt, ...) \ 648 649 dev_dbg_ratelimited((__spcm)->scomp->dev, "pcm%u (%s), dir %d: " __fmt, \ 649 - (__spcm)->pcm.pcm_id, (__spcm)->pcm.pcm_name, __dir, \ 650 - ##__VA_ARGS__) 650 + le32_to_cpu((__spcm)->pcm.pcm_id), \ 651 + (__spcm)->pcm.pcm_name, __dir, \ 652 + ##__VA_ARGS__) 651 653 652 654 #define spcm_err(__spcm, __dir, __fmt, ...) \ 653 655 dev_err((__spcm)->scomp->dev, "%s: pcm%u (%s), dir %d: " __fmt, \ 654 - __func__, (__spcm)->pcm.pcm_id, (__spcm)->pcm.pcm_name, __dir, \ 656 + __func__, le32_to_cpu((__spcm)->pcm.pcm_id), \ 657 + (__spcm)->pcm.pcm_name, __dir, \ 655 658 ##__VA_ARGS__) 656 659 657 660 #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMPRESS)
+6 -4
sound/soc/sof/topology.c
··· 776 776 break; 777 777 default: 778 778 dev_err(scomp->dev, "error: unknown token type %d\n", 779 - array->type); 779 + le32_to_cpu(array->type)); 780 780 return -EINVAL; 781 781 } 782 782 ··· 971 971 int ret; 972 972 973 973 dev_dbg(scomp->dev, "tplg: load control type %d name : %s\n", 974 - hdr->type, hdr->name); 974 + le32_to_cpu(hdr->type), hdr->name); 975 975 976 976 scontrol = kzalloc_obj(*scontrol); 977 977 if (!scontrol) ··· 1016 1016 case SND_SOC_TPLG_DAPM_CTL_PIN: 1017 1017 default: 1018 1018 dev_warn(scomp->dev, "control type not supported %d:%d:%d\n", 1019 - hdr->ops.get, hdr->ops.put, hdr->ops.info); 1019 + le32_to_cpu(hdr->ops.get), 1020 + le32_to_cpu(hdr->ops.put), 1021 + le32_to_cpu(hdr->ops.info)); 1020 1022 kfree(scontrol->name); 1021 1023 kfree(scontrol); 1022 1024 return 0; ··· 1526 1524 case snd_soc_dapm_pga: 1527 1525 if (!le32_to_cpu(tw->num_kcontrols)) { 1528 1526 dev_err(scomp->dev, "invalid kcontrol count %d for volume\n", 1529 - tw->num_kcontrols); 1527 + le32_to_cpu(tw->num_kcontrols)); 1530 1528 ret = -EINVAL; 1531 1529 break; 1532 1530 }