Skip to contentSkip to conversation

ASoC: hdac-hdmi: Add hdmi driver

DISCUSSION Dan Carpenter 1 participant 1 message Nov 26, 2015

lore
Share & tools
lore
#0 lore raw

Hello Subhransu S. Prusty,

The patch 18382ead3640: "ASoC: hdac-hdmi: Add hdmi driver" from Nov 10, 2015, leads to the following 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.

sound/soc/codecs/hdac_hdmi.c
409 static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev) 410 {

   411          hda_nid_t nid;
   412          int i;
   413          struct hdac_device *hdac = &edev->hdac;
   414          struct hdac_hdmi_priv *hdmi = edev->private_data;
   415          int cvt_nid = 0, pin_nid = 0;
   416  
   417          hdac->num_nodes = snd_hdac_get_sub_nodes(hdac, hdac->afg, &nid);
   418          if (!nid || hdac->num_nodes < 0) {
                            ^^^^^^^^^^^^^^^^^^^

snd_hdac_get_sub_nodes() never returns negatives. (We can't create a static checker warning for this because it's impossible to know if the author is planning to add error returns later). It returns zero if not found so maybe that was intended intsead?

419 dev_warn(&hdac->dev, "HDMI: failed to get afg sub nodes\n");
420 return -EINVAL;
421 }

regards,
dan carpenter