public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gspca: Fix tests of unsigned
@ 2009-12-16 15:07 Roel Kluin
  0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2009-12-16 15:07 UTC (permalink / raw)
  To: Jean-Francois Moine, linux-media, Andrew Morton, LKML

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

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Found using coccinelle: http://coccinelle.lip6.fr/

diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c
index 4dbb882..f5d1f18 100644
--- a/drivers/media/video/gspca/ov534.c
+++ b/drivers/media/video/gspca/ov534.c
@@ -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);
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c
index b1944a7..7ebabe7 100644
--- a/drivers/media/video/gspca/sn9c20x.c
+++ b/drivers/media/video/gspca/sn9c20x.c
@@ -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);
 		}

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

only message in thread, other threads:[~2009-12-16 15:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-16 15:07 [PATCH] gspca: Fix tests of unsigned Roel Kluin

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