From 48bed38d5f0787739a6a9c6d1e5f79c466b47a68 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sat, 12 Jul 2014 12:35:54 +0200 Subject: [PATCH] v4l2-compliance: fix control test The test 'step > max - min' doesn't make sense if min == max. So check for that corner case. Signed-off-by: Hans Verkuil --- utils/v4l2-compliance/v4l2-test-controls.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/v4l2-compliance/v4l2-test-controls.cpp b/utils/v4l2-compliance/v4l2-test-controls.cpp index 2c97df5..70bf97e 100644 --- a/utils/v4l2-compliance/v4l2-test-controls.cpp +++ b/utils/v4l2-compliance/v4l2-test-controls.cpp @@ -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 -- 2.7.4