linux-mips
[Top] [All Lists]

[PATCH] fix atomic_sub_if_positive() and atomic64_sub_if_positive()

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH] fix atomic_sub_if_positive() and atomic64_sub_if_positive()
From: Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
Date: Thu, 3 Jun 2004 23:13:31 +0900
Cc: yuasa@hh.iij4u.or.jp, linux-mips <linux-mips@linux-mips.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Hi Ralf,

I found the mistake about return value of atomic_sub_if_positive()  and 
atomic64_sub_if_positive().

Please apply this patch to v2.6 CVS tree.

Yoichi


diff -urN -X dontdiff linux-orig/include/asm-mips/atomic.h 
linux/include/asm-mips/atomic.h
--- linux-orig/include/asm-mips/atomic.h        Fri May 28 23:44:14 2004
+++ linux/include/asm-mips/atomic.h     Sun May 30 12:06:20 2004
@@ -228,7 +228,7 @@
 static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
 {
        unsigned long flags;
-       int temp, result;
+       int temp;
 
        spin_lock_irqsave(&atomic_lock, flags);
        temp = v->counter;
@@ -237,7 +237,7 @@
                v->counter = temp;
        spin_unlock_irqrestore(&atomic_lock, flags);
 
-       return result;
+       return temp;
 }
 
 #endif /* CONFIG_CPU_HAS_LLSC */
@@ -511,7 +511,7 @@
 static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
 {
        unsigned long flags;
-       long temp, result;
+       long temp;
 
        spin_lock_irqsave(&atomic_lock, flags);
        temp = v->counter;
@@ -520,7 +520,7 @@
                v->counter = temp;
        spin_unlock_irqrestore(&atomic_lock, flags);
 
-       return result;
+       return temp;
 }
 
 #endif /* CONFIG_CPU_HAS_LLDSCD */

<Prev in Thread] Current Thread [Next in Thread>