public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/9] sis fb: test below 0 on unsigned type_no
@ 2008-07-22  0:29 roel kluin
  0 siblings, 0 replies; only message in thread
From: roel kluin @ 2008-07-22  0:29 UTC (permalink / raw)
  To: thomas; +Cc: linux-kernel

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

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index b934384..9ec6c0e 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -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;
diff --git a/drivers/video/sis/sis_main.h b/drivers/video/sis/sis_main.h
index 3e3b7fa..5421bf2 100644
--- a/drivers/video/sis/sis_main.h
+++ b/drivers/video/sis/sis_main.h
@@ -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 {

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-22  0:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-22  0:29 [PATCH 2/9] sis fb: test below 0 on unsigned type_no roel kluin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox