[media] v4l: s5c73m3: fix negation operator
authorAndrzej Hajda <a.hajda@samsung.com>
Thu, 5 Jan 2017 12:34:07 +0000 (10:34 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 31 Jan 2017 09:56:49 +0000 (07:56 -0200)
Bool values should be negated using logical operators. Using bitwise operators
results in unexpected and possibly incorrect results.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/i2c/s5c73m3/s5c73m3-ctrls.c

index 0a060339e51667b4ded02b180bc5d8fa7f0f877a..2e7185030741919095cdef356d7b049921190fac 100644 (file)
@@ -211,7 +211,7 @@ static int s5c73m3_3a_lock(struct s5c73m3 *state, struct v4l2_ctrl *ctrl)
        }
 
        if ((ctrl->val ^ ctrl->cur.val) & V4L2_LOCK_FOCUS)
-               ret = s5c73m3_af_run(state, ~af_lock);
+               ret = s5c73m3_af_run(state, !af_lock);
 
        return ret;
 }