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/edac/i7300_edac.c:449]: (style) Expression '(X & 0x30000000) == 0x2' is always false [linux-3.5-rc5/drivers/edac/i7300_edac.c:485]: (style) Expression '(X & 0x30000000) == 0x2' is always false The source codes are branch = (GET_FBD_FAT_IDX(error_reg) == 2) ? 1 : 0; and branch = (GET_FBD_FAT_IDX(error_reg) == 2) ? 1 : 0; but #define GET_FBD_FAT_IDX(fbderr) (fbderr & (3 << 28)) so I agree with the analyser. Suggest code rework.
Good catch, thanks for reporting.
Created attachment 83851 [details] i7300_edac: Fix error flag testing Candidate fix, needs review and testing.
A patch referencing this bug report has been merged in Linux v3.7-rc8: commit 7e06b7a3333f5c7a0cec12aff20d39c5c87c0795 Author: Jean Delvare <jdelvare@suse.de> Date: Thu Oct 18 15:54:45 2012 +0200 i7300_edac: Fix error flag testing