From: Takashi Iwai <tiwai@suse.de>
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
Subject: Re: [PATCH 4/4] topology: Fix comparison of unsigned expression < 0
Date: Wed, 18 Nov 2015 14:59:03 +0100 [thread overview]
Message-ID: <s5hegfne7dk.wl-tiwai@suse.de> (raw)
In-Reply-To: <5409599d7c332c0b47008f219490dd5ab0a6a8ed.1447825540.git.mengdong.lin@linux.intel.com>
On Wed, 18 Nov 2015 08:23:59 +0100,
mengdong.lin@linux.intel.com wrote:
>
> From: Mengdong Lin <mengdong.lin@linux.intel.com>
>
> 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>
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
>
prev parent reply other threads:[~2015-11-18 13:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-18 7:21 [PATCH 0/4] topology: fix some gcc warnings mengdong.lin
2015-11-18 7:22 ` [PATCH 1/4] topology: Remove unused function write_data_block() mengdong.lin
2015-11-18 13:58 ` Takashi Iwai
2015-11-18 7:23 ` [PATCH 2/4] topology: Change variable type to fix gcc warning mengdong.lin
2015-11-18 7:15 ` Takashi Iwai
2015-11-18 7:28 ` Lin, Mengdong
2015-11-18 8:19 ` Takashi Iwai
2015-11-18 15:14 ` Lin, Mengdong
2015-11-18 15:26 ` Takashi Iwai
2015-11-18 7:23 ` [PATCH 3/4] topology: Remove unused variables mengdong.lin
2015-11-18 13:58 ` Takashi Iwai
2015-11-18 7:23 ` [PATCH 4/4] topology: Fix comparison of unsigned expression < 0 mengdong.lin
2015-11-18 13:59 ` Takashi Iwai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hegfne7dk.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=liam.r.girdwood@intel.com \
--cc=mengdong.lin@intel.com \
--cc=mengdong.lin@linux.intel.com \
--cc=subhransu.s.prusty@intel.com \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.