Skip to contentSkip to conversation

gspca: Fix tests of unsigned

PATCH New Roel Kluin 1 participant 1 message Dec 16, 2009 Media (V4L/DVB)

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 gspca: Fix tests of unsigned

val and sd->gain are unsigned so the tests did not work.

---
Found using coccinelle: http://coccinelle.lip6.fr/

drivers/media/video/gspca/ov534.c +1 -1
index 4dbb882..f5d1f18 100644
@@ -1536,7 +1536,7 @@ static void setsharpness_96(struct gspca_dev *gspca_dev)
 	u8 val;
 
 	val = sd->sharpness;
-	if (val < 0) {				/* auto */
+	if (val == -1) {				/* auto */
 		val = sccb_reg_read(gspca_dev, 0x42);	/* com17 */
 		sccb_reg_write(gspca_dev, 0xff, 0x00);
 		sccb_reg_write(gspca_dev, 0x42, val | 0x40);
drivers/media/video/gspca/sn9c20x.c +1 -1
index b1944a7..7ebabe7 100644
@@ -2319,7 +2319,7 @@ static void do_autogain(struct gspca_dev *gspca_dev, u16 avg_lum)
 		}
 	}
 	if (avg_lum > MAX_AVG_LUM) {
-		if (sd->gain - 1 >= 0) {
+		if (sd->gain >= 1) {
 			sd->gain--;
 			set_gain(gspca_dev);
 		}