Bug 50431

Summary: drivers/gpu/drm/radeon/atombios_encoders.c:1628: possible bad if test
Product: Drivers Reporter: David Binderman (dcb314)
Component: Video(DRI - non Intel)Assignee: drivers_video-dri
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan, alexdeucher, florian
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.7-rc5 Subsystem:
Regression: No Bisected commit-id:

Description David Binderman 2012-11-12 21:35:04 UTC
The source code is

            if ((rdev->family != CHIP_RV710) || (rdev->family != CHIP_RV730))
                atombios_dig_transmitter_setup(encoder,
ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);

Maybe the programmer intended

            if ((rdev->family != CHIP_RV710) && (rdev->family != CHIP_RV730))
                atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);

Here is compiler flag -Wlogical-op finding the problem

drivers/gpu/drm/radeon/atombios_encoders.c:1628:4: warning: logical ‘or’ of coll
ectively exhaustive tests is always true [-Wlogical-op]
Comment 1 Alex Deucher 2012-11-14 14:13:53 UTC
Good catch.  Thanks!  Patch queued.
Comment 2 Florian Mickler 2012-11-17 20:13:15 UTC
A patch referencing this bug report has been merged in Linux v3.7-rc6:

commit b9196395c905edec512dfd6690428084228c16ec
Author: Alex Deucher <alexander.deucher@amd.com>
Date:   Wed Nov 14 09:10:39 2012 -0500

    drm/radeon: fix logic error in atombios_encoders.c