Commit 3c83ac23 authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Mark Brown

ASoC: hdac_hdmi: check error return

As hdac->num_nodes is unsigned we can not check if
snd_hdac_get_sub_nodes() has returned error or success. Lets have a
temporary int to check the error value.
Signed-off-by: default avatarSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 65976878
...@@ -409,17 +409,18 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev, ...@@ -409,17 +409,18 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev,
static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev) static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev)
{ {
hda_nid_t nid; hda_nid_t nid;
int i; int i, num_nodes;
struct hdac_device *hdac = &edev->hdac; struct hdac_device *hdac = &edev->hdac;
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = edev->private_data;
int cvt_nid = 0, pin_nid = 0; int cvt_nid = 0, pin_nid = 0;
hdac->num_nodes = snd_hdac_get_sub_nodes(hdac, hdac->afg, &nid); num_nodes = snd_hdac_get_sub_nodes(hdac, hdac->afg, &nid);
if (!nid || hdac->num_nodes < 0) { if (!nid || num_nodes < 0) {
dev_warn(&hdac->dev, "HDMI: failed to get afg sub nodes\n"); dev_warn(&hdac->dev, "HDMI: failed to get afg sub nodes\n");
return -EINVAL; return -EINVAL;
} }
hdac->num_nodes = num_nodes;
hdac->start_nid = nid; hdac->start_nid = nid;
for (i = 0; i < hdac->num_nodes; i++, nid++) { for (i = 0; i < hdac->num_nodes; i++, nid++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment