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: soc-topology: fix __le32 conversion in printed values

A number of dev_dbg() and dev_err() calls get passed values that are
of __le32 type which does not get noticed by sparse until my variadic
checking patches.

There are a number of these, and we should probably fix these up.

The sparse warnings are numerous so the first few are listed here that
this patch fixes:

sound/soc/soc-topology.c:226:9: warning: incorrect type in argument 4 (different base types)
sound/soc/soc-topology.c:226:9: expected int
sound/soc/soc-topology.c:226:9: got restricted __le32 [usertype] get
sound/soc/soc-topology.c:226:9: warning: incorrect type in argument 5 (different base types)
sound/soc/soc-topology.c:226:9: expected int
sound/soc/soc-topology.c:226:9: got restricted __le32 [usertype] put
sound/soc/soc-topology.c:226:9: warning: incorrect type in argument 6 (different base types)
sound/soc/soc-topology.c:226:9: expected int
sound/soc/soc-topology.c:226:9: got restricted __le32 [usertype] info
sound/soc/soc-topology.c:226:9: warning: incorrect type in argument 4 (different base types)
sound/soc/soc-topology.c:226:9: expected int
sound/soc/soc-topology.c:226:9: got restricted __le32 [usertype] get
sound/soc/soc-topology.c:226:9: warning: incorrect type in argument 5 (different base types)
sound/soc/soc-topology.c:226:9: expected int
sound/soc/soc-topology.c:226:9: got restricted __le32 [usertype] put
sound/soc/soc-topology.c:226:9: warning: incorrect type in argument 6 (different base types)
sound/soc/soc-topology.c:226:9: expected int
sound/soc/soc-topology.c:226:9: got restricted __le32 [usertype] info
sound/soc/soc-topology.c:226:9: warning: incorrect type in argument 4 (different base types)
sound/soc/soc-topology.c:226:9: expected int
sound/soc/soc-topology.c:226:9: got restricted __le32 [usertype] get
sound/soc/soc-topology.c:226:9: warning: incorrect type in argument 5 (different base types)
sound/soc/soc-topology.c:226:9: expected int
sound/soc/soc-topology.c:226:9: got restricted __le32 [usertype] put
sound/soc/soc-topology.c:226:9: warning: incorrect type in argument 6 (different base types)
sound/soc/soc-topology.c:226:9: expected int
sound/soc/soc-topology.c:226:9: got restricted __le32 [usertype] info

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Link: https://patch.msgid.link/20260323175604.19315-1-ben.dooks@codethink.co.uk
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Ben Dooks and committed by
Mark Brown
1001b473 d57fe7b0

+40 -33
+40 -33
sound/soc/soc-topology.c
··· 224 224 struct snd_soc_tplg_ctl_hdr *hdr, const char *name) 225 225 { 226 226 dev_err(tplg->dev, 227 - "ASoC: no complete control IO handler for %s type (g,p,i) %d:%d:%d at 0x%lx\n", 228 - name, hdr->ops.get, hdr->ops.put, hdr->ops.info, 227 + "ASoC: no complete control IO handler for %s type (g,p,i) %u:%u:%u at 0x%lx\n", 228 + name, 229 + le32_to_cpu(hdr->ops.get), 230 + le32_to_cpu(hdr->ops.put), 231 + le32_to_cpu(hdr->ops.info), 229 232 soc_tplg_get_offset(tplg)); 230 233 } 231 234 ··· 241 238 if (tplg->ops && tplg->ops->vendor_load) 242 239 ret = tplg->ops->vendor_load(tplg->comp, tplg->index, hdr); 243 240 else { 244 - dev_err(tplg->dev, "ASoC: no vendor load callback for ID %d\n", 245 - hdr->vendor_type); 241 + dev_err(tplg->dev, "ASoC: no vendor load callback for ID %u\n", 242 + le32_to_cpu(hdr->vendor_type)); 246 243 return -EINVAL; 247 244 } 248 245 249 246 if (ret < 0) 250 247 dev_err(tplg->dev, 251 - "ASoC: vendor load failed at hdr offset %ld/0x%lx for type %d:%d\n", 248 + "ASoC: vendor load failed at hdr offset %ld/0x%lx for type %u:%u\n", 252 249 soc_tplg_get_hdr_offset(tplg), 253 250 soc_tplg_get_hdr_offset(tplg), 254 - hdr->type, hdr->vendor_type); 251 + le32_to_cpu(hdr->type), 252 + le32_to_cpu(hdr->vendor_type)); 255 253 return ret; 256 254 } 257 255 ··· 629 625 630 626 /* TODO: add support for other TLV types */ 631 627 default: 632 - dev_dbg(tplg->dev, "Unsupported TLV type %d\n", 633 - tplg_tlv->type); 628 + dev_dbg(tplg->dev, "Unsupported TLV type %u\n", 629 + le32_to_cpu(tplg_tlv->type)); 634 630 return -EINVAL; 635 631 } 636 632 } ··· 657 653 tplg->pos += sizeof(struct snd_soc_tplg_mixer_control) + le32_to_cpu(mc->priv.size); 658 654 659 655 dev_dbg(tplg->dev, "ASoC: adding mixer kcontrol %s with access 0x%x\n", 660 - mc->hdr.name, mc->hdr.access); 656 + mc->hdr.name, le32_to_cpu(mc->hdr.access)); 661 657 662 658 kc->name = devm_kstrdup(tplg->dev, mc->hdr.name, GFP_KERNEL); 663 659 if (!kc->name) ··· 780 776 781 777 tplg->pos += (sizeof(struct snd_soc_tplg_enum_control) + le32_to_cpu(ec->priv.size)); 782 778 783 - dev_dbg(tplg->dev, "ASoC: adding enum kcontrol %s size %d\n", ec->hdr.name, ec->items); 779 + dev_dbg(tplg->dev, "ASoC: adding enum kcontrol %s size %u\n", ec->hdr.name, le32_to_cpu(ec->items)); 784 780 785 781 kc->name = devm_kstrdup(tplg->dev, ec->hdr.name, GFP_KERNEL); 786 782 if (!kc->name) ··· 815 811 } 816 812 break; 817 813 default: 818 - dev_err(tplg->dev, "ASoC: invalid enum control type %d for %s\n", 819 - ec->hdr.ops.info, ec->hdr.name); 814 + dev_err(tplg->dev, "ASoC: invalid enum control type %u for %s\n", 815 + le32_to_cpu(ec->hdr.ops.info), ec->hdr.name); 820 816 return -EINVAL; 821 817 } 822 818 ··· 850 846 tplg->pos += (sizeof(struct snd_soc_tplg_bytes_control) + le32_to_cpu(be->priv.size)); 851 847 852 848 dev_dbg(tplg->dev, "ASoC: adding bytes kcontrol %s with access 0x%x\n", 853 - be->hdr.name, be->hdr.access); 849 + be->hdr.name, le32_to_cpu(be->hdr.access)); 854 850 855 851 kc->name = devm_kstrdup(tplg->dev, be->hdr.name, GFP_KERNEL); 856 852 if (!kc->name) ··· 980 976 int ret; 981 977 int i; 982 978 983 - dev_dbg(tplg->dev, "ASoC: adding %d kcontrols at 0x%lx\n", hdr->count, 979 + dev_dbg(tplg->dev, "ASoC: adding %u kcontrols at 0x%lx\n", le32_to_cpu(hdr->count), 984 980 soc_tplg_get_offset(tplg)); 985 981 986 982 for (i = 0; i < le32_to_cpu(hdr->count); i++) { ··· 1007 1003 } 1008 1004 1009 1005 if (ret < 0) { 1010 - dev_err(tplg->dev, "ASoC: invalid control type: %d, index: %d at 0x%lx\n", 1011 - control_hdr->type, i, soc_tplg_get_offset(tplg)); 1006 + dev_err(tplg->dev, "ASoC: invalid control type: %u, index: %d at 0x%lx\n", 1007 + le32_to_cpu(control_hdr->type), i, soc_tplg_get_offset(tplg)); 1012 1008 return ret; 1013 1009 } 1014 1010 } ··· 1044 1040 count, le32_to_cpu(hdr->payload_size), "graph")) 1045 1041 return -EINVAL; 1046 1042 1047 - dev_dbg(tplg->dev, "ASoC: adding %d DAPM routes for index %d\n", count, 1048 - hdr->index); 1043 + dev_dbg(tplg->dev, "ASoC: adding %d DAPM routes for index %u\n", count, 1044 + le32_to_cpu(hdr->index)); 1049 1045 1050 1046 for (i = 0; i < count; i++) { 1051 1047 route = devm_kzalloc(tplg->dev, sizeof(*route), GFP_KERNEL); ··· 1120 1116 SNDRV_CTL_ELEM_ID_NAME_MAXLEN) 1121 1117 return -EINVAL; 1122 1118 1123 - dev_dbg(tplg->dev, "ASoC: creating DAPM widget %s id %d\n", 1124 - w->name, w->id); 1119 + dev_dbg(tplg->dev, "ASoC: creating DAPM widget %s id %u\n", 1120 + w->name, le32_to_cpu(w->id)); 1125 1121 1126 1122 memset(&template, 0, sizeof(template)); 1127 1123 ··· 1204 1200 goto hdr_err; 1205 1201 break; 1206 1202 default: 1207 - dev_err(tplg->dev, "ASoC: invalid widget control type %d:%d:%d\n", 1208 - control_hdr->ops.get, control_hdr->ops.put, 1203 + dev_err(tplg->dev, "ASoC: invalid widget control type %u:%u:%u\n", 1204 + le32_to_cpu(control_hdr->ops.get), 1205 + le32_to_cpu(control_hdr->ops.put), 1209 1206 le32_to_cpu(control_hdr->ops.info)); 1210 1207 ret = -EINVAL; 1211 1208 goto hdr_err; ··· 1750 1745 link = snd_soc_find_dai_link(tplg->comp->card, le32_to_cpu(cfg->id), 1751 1746 name, stream_name); 1752 1747 if (!link) { 1753 - dev_err(tplg->dev, "ASoC: physical link %s (id %d) not exist\n", 1754 - name, cfg->id); 1748 + dev_err(tplg->dev, "ASoC: physical link %s (id %u) not exist\n", 1749 + name, le32_to_cpu(cfg->id)); 1755 1750 return -EINVAL; 1756 1751 } 1757 1752 ··· 1954 1949 { 1955 1950 if (le32_to_cpu(hdr->size) != sizeof(*hdr)) { 1956 1951 dev_err(tplg->dev, 1957 - "ASoC: invalid header size for type %d at offset 0x%lx size 0x%zx.\n", 1952 + "ASoC: invalid header size for type %u at offset 0x%lx size 0x%zx.\n", 1958 1953 le32_to_cpu(hdr->type), soc_tplg_get_hdr_offset(tplg), 1959 1954 tplg->fw->size); 1960 1955 return -EINVAL; ··· 1962 1957 1963 1958 if (soc_tplg_get_hdr_offset(tplg) + le32_to_cpu(hdr->payload_size) >= tplg->fw->size) { 1964 1959 dev_err(tplg->dev, 1965 - "ASoC: invalid header of type %d at offset %ld payload_size %d\n", 1960 + "ASoC: invalid header of type %u at offset %ld payload_size %u\n", 1966 1961 le32_to_cpu(hdr->type), soc_tplg_get_hdr_offset(tplg), 1967 - hdr->payload_size); 1962 + le32_to_cpu(hdr->payload_size)); 1968 1963 return -EINVAL; 1969 1964 } 1970 1965 ··· 1972 1967 if (le32_to_cpu(hdr->magic) == SOC_TPLG_MAGIC_BIG_ENDIAN) { 1973 1968 dev_err(tplg->dev, 1974 1969 "ASoC: pass %d big endian not supported header got %x at offset 0x%lx size 0x%zx.\n", 1975 - tplg->pass, hdr->magic, 1970 + tplg->pass, le32_to_cpu(hdr->magic), 1976 1971 soc_tplg_get_hdr_offset(tplg), tplg->fw->size); 1977 1972 return -EINVAL; 1978 1973 } ··· 1980 1975 if (le32_to_cpu(hdr->magic) != SND_SOC_TPLG_MAGIC) { 1981 1976 dev_err(tplg->dev, 1982 1977 "ASoC: pass %d does not have a valid header got %x at offset 0x%lx size 0x%zx.\n", 1983 - tplg->pass, hdr->magic, 1978 + tplg->pass, le32_to_cpu(hdr->magic), 1984 1979 soc_tplg_get_hdr_offset(tplg), tplg->fw->size); 1985 1980 return -EINVAL; 1986 1981 } ··· 1990 1985 le32_to_cpu(hdr->abi) < SND_SOC_TPLG_ABI_VERSION_MIN) { 1991 1986 dev_err(tplg->dev, 1992 1987 "ASoC: pass %d invalid ABI version got 0x%x need 0x%x at offset 0x%lx size 0x%zx.\n", 1993 - tplg->pass, hdr->abi, 1988 + tplg->pass, le32_to_cpu(hdr->abi), 1994 1989 SND_SOC_TPLG_ABI_VERSION, soc_tplg_get_hdr_offset(tplg), 1995 1990 tplg->fw->size); 1996 1991 return -EINVAL; ··· 2059 2054 2060 2055 if (tplg->pass == hdr_pass) { 2061 2056 dev_dbg(tplg->dev, 2062 - "ASoC: Got 0x%x bytes of type %d version %d vendor %d at pass %d\n", 2063 - hdr->payload_size, hdr->type, hdr->version, 2064 - hdr->vendor_type, tplg->pass); 2057 + "ASoC: Got 0x%x bytes of type %u version %u vendor %u at pass %d\n", 2058 + le32_to_cpu(hdr->payload_size), 2059 + le32_to_cpu(hdr->type), 2060 + le32_to_cpu(hdr->version), 2061 + le32_to_cpu(hdr->vendor_type), tplg->pass); 2065 2062 return elem_load(tplg, hdr); 2066 2063 } 2067 2064