summaryrefslogtreecommitdiff
path: root/cbtable.c
diff options
context:
space:
mode:
authormkarcher <mkarcher@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2010-01-12 15:36:24 +0000
committermkarcher <mkarcher@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1>2010-01-12 15:36:24 +0000
commit97839cf57726d20153b4a8009d112e48079834cd (patch)
tree0de6c940c2288444810f571fabe0687c7e1ba40a /cbtable.c
parent066fe6553bea25e06566b79472524d02dbfdf373 (diff)
downloadflashrom-97839cf57726d20153b4a8009d112e48079834cd.tar.gz
Enable -Wshadow, clean code for that
This is not just for fun. We hit a real bug on BSD with the outl macros. The macro variable tmp collided with the tmp from outer scope. second revision, now also taking care of inb/inw/inl. While that shadowing did not introduce bugs (yet), of course it breaks the build on BSD when -Wshadow is enabled. Signed-off-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de> Acked-by: Luc Verhaegen <libv@skynet.be> git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@860 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'cbtable.c')
-rw-r--r--cbtable.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/cbtable.c b/cbtable.c
index 2bc1bfa..2611a62 100644
--- a/cbtable.c
+++ b/cbtable.c
@@ -50,7 +50,7 @@ static unsigned long compute_checksum(void *addr, unsigned long length)
volatile union {
uint8_t byte[2];
uint16_t word;
- } value;
+ } chksum;
unsigned long sum;
unsigned long i;
@@ -72,10 +72,10 @@ static unsigned long compute_checksum(void *addr, unsigned long length)
sum = (sum + (sum >> 16)) & 0xFFFF;
}
}
- value.byte[0] = sum & 0xff;
- value.byte[1] = (sum >> 8) & 0xff;
+ chksum.byte[0] = sum & 0xff;
+ chksum.byte[1] = (sum >> 8) & 0xff;
- return (~value.word) & 0xFFFF;
+ return (~chksum.word) & 0xFFFF;
}
#define for_each_lbrec(head, rec) \