topology: Fix comparison of unsigned expression < 0

Fix gcc warning: comparison of unsigned expression < 0 is always false
[-Wtype-limits]

The ABI object channel->id is _le32 and is converted to host unsigned
integer. It cannot be < 0.

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-18 02:23:59 -05:00 committed by Takashi Iwai
parent 605551aec6
commit 8504a41d94

View file

@ -80,6 +80,7 @@ int tplg_parse_channel(snd_tplg_t *tplg,
snd_config_t *n; snd_config_t *n;
struct snd_soc_tplg_channel *channel = private; struct snd_soc_tplg_channel *channel = private;
const char *id, *value; const char *id, *value;
int channel_id;
if (tplg->channel_idx >= SND_SOC_TPLG_MAX_CHAN) if (tplg->channel_idx >= SND_SOC_TPLG_MAX_CHAN)
return -EINVAL; return -EINVAL;
@ -88,12 +89,13 @@ int tplg_parse_channel(snd_tplg_t *tplg,
snd_config_get_id(cfg, &id); snd_config_get_id(cfg, &id);
tplg_dbg("\tChannel %s at index %d\n", id, tplg->channel_idx); tplg_dbg("\tChannel %s at index %d\n", id, tplg->channel_idx);
channel->id = lookup_channel(id); channel_id = lookup_channel(id);
if (channel->id < 0) { if (channel_id < 0) {
SNDERR("error: invalid channel %s\n", id); SNDERR("error: invalid channel %s\n", id);
return -EINVAL; return -EINVAL;
} }
channel->id = channel_id;
channel->size = sizeof(*channel); channel->size = sizeof(*channel);
tplg_dbg("\tChan %s = %d\n", id, channel->id); tplg_dbg("\tChan %s = %d\n", id, channel->id);