ASoC: soc-core: Fix sparse warning in be32_to_cpup() call
PATCH 1/1 ASoC: soc-core: Fix sparse warning in be32_to_cpup() call
--- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +1 -1
@@ -3301,7 +3301,7 @@ static int snd_soc_of_get_slot_mask(struct device_node *np,return 0 ; val /=sizeof (u32);for (i =0 ; i < val; i++) -if (be32_to_cpup (&of_slot_mask[i])) +if (be32_to_cpup ((__be32 *)&of_slot_mask[i])) *mask |= (1 << i);return val;
Signature · 1 line
1.9.1
Mark Brown
maintainersound/soc/soc-core.c static int snd_soc_of_get_slot_mask(struct device_node *np, · line 3305
Quoted 6 lines · Jyri Sarha
sound/soc/soc-core.c +1
-1val /=sizeof (u32);for (i =0 ; i < val; i++) -if (be32_to_cpup (&of_slot_mask[i])) +if (be32_to_cpup ((__be32 *)&of_slot_mask[i])) *mask |= (1 << i);
There was no changelog and this is setting off alarm bells since the cast just smashes warnings - are you sure we're not missing some other annotations and that a cast is the best thing here?
Quoted 13 lines · Mark Brown
sound/soc/soc-core.c static int snd_soc_of_get_slot_mask(struct device_node *np, · line 3305
Quoted 6 lines · Jyri Sarha
val /= sizeof(u32); for (i = 0; i < val; i++)sound/soc/soc-core.c +1
-1-if (be32_to_cpup (&of_slot_mask[i])) +if (be32_to_cpup ((__be32 *)&of_slot_mask[i])) *mask |= (1 << i);There was no changelog and this is setting off alarm bells since the cast just smashes warnings - are you sure we're not missing some other annotations and that a cast is the best thing here?
You are right, I was a bit hasty. It is better to declare of_slot_mask to const __be32 * in the first place, instead of just const u32 * and then casting it to something else.
I'll send a new patch shortly.
BR,
Jyri