bitops: fix test_and_change_bit()
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 bitops: fix test_and_change_bit()
./bitops.h:192: warning: ‘old’ is used uninitialized in this function
Signed-off-by Corentin Chary <[email protected]>
--- bitops.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
bitops.h +1 -1
@@ -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
Blue Swirl
AppliedThanks, applied.
Quoted 25 lines · Corentin Chary
./bitops.h:192: warning: ‘old’ is used uninitialized in this function
Signed-off-by Corentin Chary <[email protected]>---
bitops.h | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)bitops.h +1
-2@@ -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