diff options
-rw-r--r-- | arch/m32r/kernel/sys_m32r.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c index e0500e12c5fb..fe55b28d3725 100644 --- a/arch/m32r/kernel/sys_m32r.c +++ b/arch/m32r/kernel/sys_m32r.c | |||
@@ -41,7 +41,8 @@ asmlinkage int sys_tas(int *addr) | |||
41 | return -EFAULT; | 41 | return -EFAULT; |
42 | local_irq_save(flags); | 42 | local_irq_save(flags); |
43 | oldval = *addr; | 43 | oldval = *addr; |
44 | *addr = 1; | 44 | if (!oldval) |
45 | *addr = 1; | ||
45 | local_irq_restore(flags); | 46 | local_irq_restore(flags); |
46 | return oldval; | 47 | return oldval; |
47 | } | 48 | } |
@@ -59,7 +60,8 @@ asmlinkage int sys_tas(int *addr) | |||
59 | 60 | ||
60 | _raw_spin_lock(&tas_lock); | 61 | _raw_spin_lock(&tas_lock); |
61 | oldval = *addr; | 62 | oldval = *addr; |
62 | *addr = 1; | 63 | if (!oldval) |
64 | *addr = 1; | ||
63 | _raw_spin_unlock(&tas_lock); | 65 | _raw_spin_unlock(&tas_lock); |
64 | 66 | ||
65 | return oldval; | 67 | return oldval; |