All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: soc-core: Fix sparse warning in be32_to_cpup() call
@ 2015-09-17  8:02 Jyri Sarha
  2015-09-17  9:22 ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Jyri Sarha @ 2015-09-17  8:02 UTC (permalink / raw)
  To: linux-omap, alsa-devel
  Cc: peter.ujfalusi, liam.r.girdwood, broonie, Jyri Sarha

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 sound/soc/soc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1929f0e..614b831 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -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;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: soc-core: Fix sparse warning in be32_to_cpup() call
  2015-09-17  8:02 [PATCH] ASoC: soc-core: Fix sparse warning in be32_to_cpup() call Jyri Sarha
@ 2015-09-17  9:22 ` Mark Brown
  2015-09-17  9:33   ` Jyri Sarha
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2015-09-17  9:22 UTC (permalink / raw)
  To: Jyri Sarha; +Cc: peter.ujfalusi, liam.r.girdwood, alsa-devel, linux-omap


[-- Attachment #1.1: Type: text/plain, Size: 441 bytes --]

On Thu, Sep 17, 2015 at 11:02:57AM +0300, Jyri Sarha wrote:

>  	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);
>  

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?

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: soc-core: Fix sparse warning in be32_to_cpup() call
  2015-09-17  9:22 ` Mark Brown
@ 2015-09-17  9:33   ` Jyri Sarha
  0 siblings, 0 replies; 3+ messages in thread
From: Jyri Sarha @ 2015-09-17  9:33 UTC (permalink / raw)
  To: Mark Brown; +Cc: peter.ujfalusi, liam.r.girdwood, alsa-devel, linux-omap

On 09/17/15 12:22, Mark Brown wrote:
> On Thu, Sep 17, 2015 at 11:02:57AM +0300, Jyri Sarha wrote:
>
>>   	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);
>>
>
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-17  9:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-17  8:02 [PATCH] ASoC: soc-core: Fix sparse warning in be32_to_cpup() call Jyri Sarha
2015-09-17  9:22 ` Mark Brown
2015-09-17  9:33   ` Jyri Sarha

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.