Question about the right fix for a sparse warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Takashi,

We're seeing the following sparse warning in the SOF code:

sound/soc/sof/sof-audio.c:86:31: warning: incorrect type in assignment
(different base types)
sound/soc/sof/sof-audio.c:86:31:    expected restricted
snd_pcm_state_t [usertype] state
sound/soc/sof/sof-audio.c:86:31:    got signed int [signed] [usertype]
[explicitly-signed] state

The line under scrutiny where we assign "state" is as follows:

state = substream->runtime->status->state;

and it is defined as
snd_pcm_state_t state;

There are other places (ex pcm_oss.c) where a similar assignment has been
used as well.

What fixes the issue is a forced cast to snd_pcm_state_t as below before
assigning:
 state = (__force snd_pcm_state_t)substream->runtime->status->state;

Do you think this is acceptable? If not, could you please suggest an
alternative?

Thanks,
Ranjani
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux