From: Takashi Iwai Subject: Re: [PATCH 4/4] topology: Fix comparison of unsigned expression < 0 Date: Wed, 18 Nov 2015 14:59:03 +0100 Message-ID: References: <5409599d7c332c0b47008f219490dd5ab0a6a8ed.1447825540.git.mengdong.lin@linux.intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id D65442657DF for ; Wed, 18 Nov 2015 14:59:03 +0100 (CET) In-Reply-To: <5409599d7c332c0b47008f219490dd5ab0a6a8ed.1447825540.git.mengdong.lin@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: mengdong.lin@linux.intel.com Cc: vinod.koul@intel.com, mengdong.lin@intel.com, alsa-devel@alsa-project.org, subhransu.s.prusty@intel.com, liam.r.girdwood@intel.com List-Id: alsa-devel@alsa-project.org On Wed, 18 Nov 2015 08:23:59 +0100, mengdong.lin@linux.intel.com wrote: > > From: Mengdong Lin > > 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 Applied, thanks. Takashi > > diff --git a/src/topology/channel.c b/src/topology/channel.c > index 9bc5d5a..c2f1fea 100644 > --- a/src/topology/channel.c > +++ b/src/topology/channel.c > @@ -80,6 +80,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, > snd_config_t *n; > struct snd_soc_tplg_channel *channel = private; > const char *id, *value; > + int channel_id; > > if (tplg->channel_idx >= SND_SOC_TPLG_MAX_CHAN) > return -EINVAL; > @@ -88,12 +89,13 @@ int tplg_parse_channel(snd_tplg_t *tplg, > snd_config_get_id(cfg, &id); > tplg_dbg("\tChannel %s at index %d\n", id, tplg->channel_idx); > > - channel->id = lookup_channel(id); > - if (channel->id < 0) { > + channel_id = lookup_channel(id); > + if (channel_id < 0) { > SNDERR("error: invalid channel %s\n", id); > return -EINVAL; > } > > + channel->id = channel_id; > channel->size = sizeof(*channel); > tplg_dbg("\tChan %s = %d\n", id, channel->id); > > -- > 2.5.0 >