diff mbox

bitops: fix test_and_change_bit()

Message ID 1298587628-18187-1-git-send-email-corentincj@iksaif.net
State New
Headers show

Commit Message

Corentin Chary Feb. 24, 2011, 10:47 p.m. UTC
./bitops.h:192: warning: ‘old’ is used uninitialized in this function

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 bitops.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Blue Swirl Feb. 25, 2011, 6:07 p.m. UTC | #1
Thanks, applied.

On Fri, Feb 25, 2011 at 12:47 AM, Corentin Chary <corentincj@iksaif.net> wrote:
> ./bitops.h:192: warning: ‘old’ is used uninitialized in this function
>
> Signed-off-by: Corentin Chary <corentincj@iksaif.net>
> ---
>  bitops.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/bitops.h b/bitops.h
> index ae7bcb1..e2b9df3 100644
> --- a/bitops.h
> +++ b/bitops.h
> @@ -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
>
>
>
diff mbox

Patch

diff --git a/bitops.h b/bitops.h
index ae7bcb1..e2b9df3 100644
--- a/bitops.h
+++ b/bitops.h
@@ -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;