Skip to contentSkip to conversation

bitops: fix test_and_change_bit()

PATCH Applied Corentin Chary 2 participants 2 messages Feb 24, 2011 – Feb 25, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 bitops: fix test_and_change_bit()

./bitops.h:192: warning: ‘old’ is used uninitialized in this function

---
 bitops.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
bitops.h +1 -1
index ae7bcb1..e2b9df3 100644
@@ -187,7 +187,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
 {
 	unsigned long mask = BIT_MASK(nr);
 	unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
-	unsigned long old;
+	unsigned long old = *p;
 
 	*p = old ^ mask;
 	return (old & mask) != 0;
Signature · 1 line
1.7.4.1
Applied
#2 lore raw

Thanks, applied.

Quoted 25 lines · Corentin Chary

./bitops.h:192: warning: ‘old’ is used uninitialized in this function

---
 bitops.h |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
bitops.h +1 -2
index ae7bcb1..e2b9df3 100644
@@ -187,7 +187,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
  {
        unsigned long mask = BIT_MASK(nr);
        unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
-       unsigned long old;
+       unsigned long old = *p;
 
        *p = old ^ mask;
        return (old & mask) != 0;
--

1.7.4.1