ASoC: hdac_hdmi: remove always false condition
PATCH 1/1 ASoC: hdac_hdmi: remove always false condition
hdac->num_nodes is unsigned int and can never be less than 0.
Signed-off-by Sudip Mukherjee <[email protected]>
---
Or, maybe, another way can be to declare num_nodes as int. Then this test makes sense and also snd_hdac_get_sub_nodes() is returning an int.
sound/soc/codecs/hdac_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/hdac_hdmi.c +1 -1
@@ -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) {dev_warn (&hdac->dev,"HDMI: failed to get afg sub nodes\n" );return -EINVAL ; }
Signature · 1 line
1.9.1
Mark Brown
maintainerQuoted 4 lines · Sudip Mukherjee
hdac->num_nodesis unsigned int and can never be less than 0.Or, maybe, another way can be to declare
num_nodesas int. Then this test makes sense and alsosnd_hdac_get_sub_nodes()is returning an int.
Yes, that's a better fix:
sound/soc/codecs/hdac_hdmi.c static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev) · line 418
Quoted 3 lines
sound/soc/codecs/hdac_hdmi.c +1
-1hdac->num_nodes =snd_hdac_get_sub_nodes (hdac, hdac->afg, &nid); -if (!nid || hdac->num_nodes <0 ) { +if (!nid) {
it's clear that we're looking for an error code on failure here.