Bug 44051

Summary: cx25821-medusa-video.c:502: bad if test
Product: Drivers Reporter: David Binderman (dcb314)
Component: Video(Other)Assignee: Alan (alan)
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan, florian
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.5-rc5 Subsystem:
Regression: No Bisected commit-id:

Description David Binderman 2012-07-01 14:20:19 UTC
I just ran the static analyser cppcheck over the source code of the
linux kernel version 3.5-rc5.

It said

[linux-3.5-rc5/drivers/media/video/cx25821/cx25821-medusa-video.c:502]: (warning) Logical conjunction always evaluates to false: decoder < 0 && decoder > 7.


The source code is

    if (decoder < VDEC_A && decoder > VDEC_H) {

I think you might be better off with 

    if (decoder < VDEC_A || decoder > VDEC_H) {
Comment 1 Alan 2012-07-02 12:44:37 UTC
Patch queued
Comment 2 Florian Mickler 2012-08-04 19:11:17 UTC
A patch referencing this bug report has been merged in Linux v3.6-rc1:

commit c79a3c352469ea0a9cb2ed9e32c1932a7ff66c5c
Author: Alan Cox <alan@linux.intel.com>
Date:   Tue Jul 24 12:00:24 2012 -0300

    [media] cx25821,medusa: incorrect check on decoder type