topology: Not compare a for loop iterator with ABI __le32 variables

The iterator 'i' in a loop is a usually a integer. But ABI variables use
type _le32, which is converted to host unsigned integer. Comparing them
can cause gcc warning: comparison between signed and unsigned integer
expressions[-Wsign-compare].

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Mengdong Lin 2015-11-19 03:33:05 -05:00 committed by Takashi Iwai
parent 8504a41d94
commit cde9a37c06
2 changed files with 13 additions and 13 deletions

View file

@ -676,7 +676,7 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer,
struct snd_soc_tplg_private *priv = mixer->priv; struct snd_soc_tplg_private *priv = mixer->priv;
struct snd_soc_tplg_mixer_control *mc; struct snd_soc_tplg_mixer_control *mc;
struct tplg_elem *elem; struct tplg_elem *elem;
int ret, i; int ret, i, num_channels;
tplg_dbg(" Control Mixer: %s\n", mixer->hdr.name); tplg_dbg(" Control Mixer: %s\n", mixer->hdr.name);
@ -708,9 +708,10 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer,
for (i = 0; i < SND_SOC_TPLG_MAX_CHAN; i++) for (i = 0; i < SND_SOC_TPLG_MAX_CHAN; i++)
mc->channel[i].reg = -1; mc->channel[i].reg = -1;
if (mixer->map) num_channels = mixer->map ? mixer->map->num_channels : 0;
mc->num_channels = mixer->map->num_channels; mc->num_channels = num_channels;
for (i = 0; i < mc->num_channels; i++) {
for (i = 0; i < num_channels; i++) {
struct snd_tplg_channel_elem *channel = &mixer->map->channel[i]; struct snd_tplg_channel_elem *channel = &mixer->map->channel[i];
mc->channel[i].size = channel->size; mc->channel[i].size = channel->size;
@ -743,7 +744,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl,
{ {
struct snd_soc_tplg_enum_control *ec; struct snd_soc_tplg_enum_control *ec;
struct tplg_elem *elem; struct tplg_elem *elem;
int ret, i; int ret, i, num_items;
tplg_dbg(" Control Enum: %s\n", enum_ctl->hdr.name); tplg_dbg(" Control Enum: %s\n", enum_ctl->hdr.name);
@ -765,15 +766,14 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl,
return ret; return ret;
} }
ec->items = enum_ctl->items; num_items = enum_ctl->items < SND_SOC_TPLG_NUM_TEXTS ?
if (ec->items > SND_SOC_TPLG_NUM_TEXTS) enum_ctl->items : SND_SOC_TPLG_NUM_TEXTS;
ec->items = SND_SOC_TPLG_NUM_TEXTS; ec->items = num_items;
ec->mask = enum_ctl->mask; ec->mask = enum_ctl->mask;
ec->count = enum_ctl->items; ec->count = enum_ctl->items;
if (enum_ctl->texts != NULL) { if (enum_ctl->texts != NULL) {
for (i = 0; i < ec->items; i++) { for (i = 0; i < num_items; i++) {
if (enum_ctl->texts[i] != NULL) if (enum_ctl->texts[i] != NULL)
strncpy(ec->texts[i], enum_ctl->texts[i], strncpy(ec->texts[i], enum_ctl->texts[i],
SNDRV_CTL_ELEM_ID_NAME_MAXLEN); SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
@ -781,7 +781,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl,
} }
if (enum_ctl->values != NULL) { if (enum_ctl->values != NULL) {
for (i = 0; i < ec->items; i++) { for (i = 0; i < num_items; i++) {
if (enum_ctl->values[i]) if (enum_ctl->values[i])
continue; continue;

View file

@ -550,7 +550,7 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
} }
pcm->num_streams = pcm_tpl->num_streams; pcm->num_streams = pcm_tpl->num_streams;
for (i = 0; i < pcm->num_streams; i++) for (i = 0; i < pcm_tpl->num_streams; i++)
tplg_add_stream_object(&pcm->stream[i], &pcm_tpl->stream[i]); tplg_add_stream_object(&pcm->stream[i], &pcm_tpl->stream[i]);
return 0; return 0;
@ -583,7 +583,7 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
lk->id = link->id; lk->id = link->id;
lk->num_streams = link->num_streams; lk->num_streams = link->num_streams;
for (i = 0; i < lk->num_streams; i++) for (i = 0; i < link->num_streams; i++)
tplg_add_stream_object(&lk->stream[i], &link->stream[i]); tplg_add_stream_object(&lk->stream[i], &link->stream[i]);
return 0; return 0;