Skip to contentSkip to conversation

sis fb: test below 0 on unsigned type_no

PATCH In review roel kluin 1 participant 1 message Jul 22, 2008 Framebuffer layer

lore
Share & tools
lore

roel kluin

author
#0 lore raw

PATCH 2/9 sis fb: test below 0 on unsigned type_no

u32 type_no, member of structs sis_{crt2,tv}type are unsigned, so assignment of -1 and subsequent tests fail

---

drivers/video/sis/sis_main.c +2 -2
index b934384..9ec6c0e 100644
@@ -266,7 +266,7 @@ sisfb_search_crt2type(const char *name)
 
 	if(name == NULL) return;
 
-	while(sis_crt2type[i].type_no != -1) {
+	while (sis_crt2type[i].type_no != ~0) {
 		if(!strnicmp(name, sis_crt2type[i].name, strlen(sis_crt2type[i].name))) {
 			sisfb_crt2type = sis_crt2type[i].type_no;
 			sisfb_tvplug = sis_crt2type[i].tvplug_no;
@@ -293,7 +293,7 @@ sisfb_search_tvstd(const char *name)
 	if(name == NULL)
 		return;
 
-	while(sis_tvtype[i].type_no != -1) {
+	while (sis_tvtype[i].type_no != ~0) {
 		if(!strnicmp(name, sis_tvtype[i].name, strlen(sis_tvtype[i].name))) {
 			sisfb_tvstd = sis_tvtype[i].type_no;
 			break;
drivers/video/sis/sis_main.h +2 -2
index 3e3b7fa..5421bf2 100644
@@ -390,7 +390,7 @@ static struct _sis_crt2type {
 	{"YPBPR1080I",	     CRT2_TV,   TV_YPBPR|TV_YPBPR1080I, FL_315},
 	{"DSTN",             CRT2_LCD,  -1,                     FL_315|FL_550_DSTN},
 	{"FSTN",             CRT2_LCD,  -1,                     FL_315|FL_550_FSTN},
-	{"\0",  	     -1, 	-1,                     0}
+	{"\0",  	     ~0, 	-1,                     0}
 };
 
 /* TV standard */
@@ -403,7 +403,7 @@ static struct _sis_tvtype {
 	{"PALM",  	TV_PAL|TV_PALM},
 	{"PALN",  	TV_PAL|TV_PALN},
 	{"NTSCJ",  	TV_NTSC|TV_NTSCJ},
-	{"\0",   	-1}
+	{"\0",   	~0}
 };
 
 static const struct _sis_vrate {