Bug 78091

Summary: staging/xgifb/vb_setmode.c: 2 * bad if tests ?
Product: Drivers Reporter: David Binderman (dcb314)
Component: StagingAssignee: drivers_staging (drivers_staging)
Status: NEW ---    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.16-rc1 Subsystem:
Regression: No Bisected commit-id:

Description David Binderman 2014-06-16 10:45:13 UTC
[linux-3.16-rc1/drivers/staging/xgifb/vb_setmode.c:3732] -> [linux-3.16-rc1/drivers/staging/xgifb/vb_setmode.c:3734]: (style) Mismatching assignment and comparison, comparison 'tempah==34' is always false.
[linux-3.16-rc1/drivers/staging/xgifb/vb_setmode.c:3732] -> [linux-3.16-rc1/drivers/staging/xgifb/vb_setmode.c:3738]: (style) Mismatching assignment and comparison, comparison 'tempah==35' is always false.

Source code is

    tempah &= PanelResInfo;

    if ((tempah == Panel_1024x768) || (tempah == Panel_1024x768x75)) {
        tempbx = 1024;
        tempcx = 768;
    } else if ((tempah == Panel_1280x1024) ||
           (tempah == Panel_1280x1024x75)) {


but

#define PanelResInfo            0x1F /* CR36 Panel Type/LCDResInfo */
#define Panel_1024x768x75        0x22
#define Panel_1280x1024x75       0x23

Something that's been ANDed with 0x1F can only have a maximum
value of 31, so can never be equal to 34 or 35.

Suggest code rework.
Comment 1 David Binderman 2014-07-21 10:58:45 UTC
Still broken over a month later.