v4l2-compliance: fix control test
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 12 Jul 2014 10:35:54 +0000 (12:35 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Sat, 12 Jul 2014 10:35:54 +0000 (12:35 +0200)
The test 'step > max - min' doesn't make sense if min == max.
So check for that corner case.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/v4l2-compliance/v4l2-test-controls.cpp

index 2c97df5..70bf97e 100644 (file)
@@ -79,7 +79,8 @@ static int checkQCtrl(struct node *node, struct test_queryctrl &qctrl)
                        return fail("step == 0\n");
                if (qctrl.step < 0)
                        return fail("step < 0\n");
-               if ((unsigned)qctrl.step > (unsigned)(qctrl.maximum - qctrl.minimum))
+               if ((unsigned)qctrl.step > (unsigned)(qctrl.maximum - qctrl.minimum) &&
+                   qctrl.maximum != qctrl.minimum)
                        return fail("step > max - min\n");
                if ((qctrl.maximum - qctrl.minimum) % qctrl.step) {
                        // This really should be a fail, but there are so few