[alsa-devel] [PATCH] ALSA: dice: improve support for ancient firmware for DICE

Takashi Sakamoto o-takashi at sakamocchi.jp
Tue Apr 24 14:57:25 CEST 2018


Hi,

On Apr 24 2018 20:49, Takashi Iwai wrote:
> On Sun, 22 Apr 2018 20:25:36 +0200,
> kbuild test robot wrote:
>>
>> sparse warnings: (new ones prefixed by >>)
>>
>>>> sound/firewire/dice/dice-transaction.c:334:21: sparse: restricted __be32 degrades to integer
>>     sound/firewire/dice/dice-transaction.c:336:21: sparse: restricted __be32 degrades to integer
>>
>> vim +334 sound/firewire/dice/dice-transaction.c
> (snip)
>>     333		/* Old firmware doesn't support these fields. */
>>   > 334		if (pointers[7] > 0)
>>     335			dice->sync_offset = be32_to_cpu(pointers[6]) * 4;
>>     336		if (pointers[9] > 0)
>>     337			dice->rsrv_offset = be32_to_cpu(pointers[8]) * 4;
> 
> The warning looks reasonable.

Yep. The integer value can be negative.

> Alternatively, you can rewrite it as a non-zero check:
> 	if (pointers[7])
> 		....
> Then it would be OK without endian conversion.

OK. I'll repost.


Thanks

Takashi Sakamoto


More information about the Alsa-devel mailing list