Bug 44331 - sis/init.c: bad if test
Summary: sis/init.c: bad if test
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(Other) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Alan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-08 20:06 UTC by David Binderman
Modified: 2012-08-04 19:07 UTC (History)
2 users (show)

See Also:
Kernel Version: 3.5-rc6
Subsystem:
Regression: No
Bisected commit-id:


Attachments

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

Note You need to log in before you can comment on or make changes to this bug.