[alsa-devel] [PATCH 01/15] ASoC: hdac_hdmi: Fix to check num nodes correctly
Takashi Iwai
tiwai at suse.de
Tue Dec 1 13:27:13 CET 2015
On Tue, 01 Dec 2015 18:46:57 +0100,
Subhransu S. Prusty wrote:
>
> This patch fixes below static checker warning.
> sound/soc/codecs/hdac_hdmi.c:416 hdac_hdmi_parse_and_map_nid()
> warn: unsigned 'hdac->num_nodes' is never less than zero.
>
> Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
> Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty at intel.com>
> Signed-off-by: Vinod Koul <vinod.koul at intel.com>
> ---
> sound/soc/codecs/hdac_hdmi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
> index 205f2c2..65596b9 100644
> --- a/sound/soc/codecs/hdac_hdmi.c
> +++ b/sound/soc/codecs/hdac_hdmi.c
> @@ -415,7 +415,7 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev)
> int cvt_nid = 0, pin_nid = 0;
>
> hdac->num_nodes = snd_hdac_get_sub_nodes(hdac, hdac->afg, &nid);
> - if (!nid || hdac->num_nodes < 0) {
> + if (!nid || hdac->num_nodes <= 0) {
Checking zero is good, but checking negative is wrong here for
unsigned int.
Takashi
> dev_warn(&hdac->dev, "HDMI: failed to get afg sub nodes\n");
> return -EINVAL;
> }
> --
> 1.9.1
>
More information about the Alsa-devel
mailing list