Skip to contentSkip to conversation

ASoC: soc-core: Fix sparse warning in be32_to_cpup() call

PATCH New Jyri Sarha 1 participant 1 message Sep 17, 2015

Subsystems (2)
lore
Share & tools
lore

Jyri Sarha

author
#0 lore raw

PATCH v3 1/1 ASoC: soc-core: Fix sparse warning in be32_to_cpup() call

Store return value of of_get_property() to a pointer of __be32 type as device tree has big endian type. This fixes a sparse warning couple of lines later when be32_to_cpup() is used to convert from big endian to cpu endian.

The whole conversion is not really necessary, as we are only checking if the value is zero or not, but I wanted to add it to remind in the future that the data has to be converted before use. Compiler should optimize the unnecessary operations away.

---
Damn, I wrote description ready but forgot to produce the patch again. So here is a v3 of the same one liner patch.

 sound/soc/soc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +1 -1
index 1929f0e..af4999c 100644
@@ -3294,7 +3294,7 @@ static int snd_soc_of_get_slot_mask(struct device_node *np,
 				    unsigned int *mask)
 {
 	u32 val;
-	const u32 *of_slot_mask = of_get_property(np, prop_name, &val);
+	const __be32 *of_slot_mask = of_get_property(np, prop_name, &val);
 	int i;
 
 	if (!of_slot_mask)
Signature · 1 line
1.9.1