From: Takashi Iwai Subject: Re: [PATCH 2/4] topology: Change variable type to fix gcc warning Date: Wed, 18 Nov 2015 08:15:43 +0100 Message-ID: References: <52b9413a02fff6e7edb4541023fe53bb495bbf91.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 4471F265453 for ; Wed, 18 Nov 2015 08:15:44 +0100 (CET) In-Reply-To: <52b9413a02fff6e7edb4541023fe53bb495bbf91.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:07 +0100, mengdong.lin@linux.intel.com wrote: > > From: Mengdong Lin > > Fix warning: comparison between signed and unsigned integer expressions > [-Wsign-compare] > > ABI objects use type _le32, which is converted to host unsigned integer. > So the iterator 'i' in a loop as below should also be unsigned. > for (i = 0; i < pcm->num_streams; i++) > ^ Using an unsigned int for the generic loop count like i is strange. Rather compare with the original value in the template, which is actually int. Takashi > Signed-off-by: Mengdong Lin > > diff --git a/src/topology/ctl.c b/src/topology/ctl.c > index 7d8787f..6dc3b3d 100644 > --- a/src/topology/ctl.c > +++ b/src/topology/ctl.c > @@ -676,7 +676,8 @@ 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_mixer_control *mc; > struct tplg_elem *elem; > - int ret, i; > + int ret; > + unsigned int i; > > tplg_dbg(" Control Mixer: %s\n", mixer->hdr.name); > > @@ -743,7 +744,8 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl, > { > struct snd_soc_tplg_enum_control *ec; > struct tplg_elem *elem; > - int ret, i; > + int ret; > + unsigned int i; > > tplg_dbg(" Control Enum: %s\n", enum_ctl->hdr.name); > > diff --git a/src/topology/pcm.c b/src/topology/pcm.c > index 9b7e402..4b7c058 100644 > --- a/src/topology/pcm.c > +++ b/src/topology/pcm.c > @@ -522,7 +522,7 @@ int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) > struct snd_tplg_pcm_template *pcm_tpl = t->pcm; > struct snd_soc_tplg_pcm *pcm; > struct tplg_elem *elem; > - int i; > + unsigned int i; > > tplg_dbg("PCM: %s, DAI %s\n", pcm_tpl->pcm_name, pcm_tpl->dai_name); > > @@ -564,7 +564,7 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) > struct snd_tplg_link_template *link = t->link; > struct snd_soc_tplg_link_config *lk; > struct tplg_elem *elem; > - int i; > + unsigned int i; > > if (t->type != SND_TPLG_TYPE_BE && t->type != SND_TPLG_TYPE_CC) > return -EINVAL; > -- > 2.5.0 >