Bug 44331

Summary: sis/init.c: 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-rc6 Subsystem:
Regression: No Bisected commit-id:

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

It said

[linux-3.5-rc6/drivers/video/sis/init.c:2631]: (warning) Logical disjunction always evaluates to true: VCLK < 234 || VCLK == 203.

The source code is

         if((VCLK == 203) || (VCLK < 234)) data = 0x02;

The first section of the if is obviously redundant, 
but I suspect the statement needs better rework than that.
Comment 1 Alan 2012-07-10 15:56:58 UTC
Not sure it does actually. People tend to write code like that when disentangling a data sheet that says things of that nature 8)
Comment 2 Alan 2012-07-11 13:06:49 UTC
Patch queued
Comment 3 Florian Mickler 2012-08-04 19:07:25 UTC
A patch referencing this bug report has been merged in Linux v3.6-rc1:

commit 39012f68058e845b63b98fc07f37cf631dddbed3
Author: Alan Cox <alan@linux.intel.com>
Date:   Wed Jul 11 14:22:56 2012 +0100

    via: Remove bogus if check