Skip to contentSkip to conversation

ASoC: hdac_hdmi: convert num_nodes to int

PATCH In review Sudip Mukherjee 2 participants 2 messages Nov 26, 2015 Sound

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: hdac_hdmi: convert num_nodes to int

All uses of num_nodes are considering it as a signed integer and that is very much clear when we try to save the error value in it and later try to compare it with less than 0.

---
 include/sound/hdaudio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/sound/hdaudio.h +1 -1
index e2b712c..c5fad14 100644
@@ -71,7 +71,7 @@ struct hdac_device {
 			 unsigned int flags, unsigned int *res);
 
 	/* widgets */
-	unsigned int num_nodes;
+	int num_nodes;
 	hda_nid_t start_nid, end_nid;
 
 	/* misc flags */
Signature · 1 line
1.9.1
#1 lore raw
Quoted 4 lines · Sudip Mukherjee

All uses of num_nodes are considering it as a signed integer and that is very much clear when we try to save the error value in it and later try to compare it with less than 0.

No. The point is that the value checked *there* has to be int, not the value used for the success case. Just have a temporary value, e.g. int num_nodes, assign there, check it, then assign the value to codec->num_nodes field. The num_nodes field itself is obviously an unsigned.

Takashi

Quoted 23 lines
---
 include/sound/hdaudio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/sound/hdaudio.h +1 -1
index e2b712c..c5fad14 100644
@@ -71,7 +71,7 @@ struct hdac_device {
 			 unsigned int flags, unsigned int *res);
 
 	/* widgets */
-	unsigned int num_nodes;
+	int num_nodes;
 	hda_nid_t start_nid, end_nid;
 
 	/* misc flags */
Signature · 1 line
1.9.1