diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c index e0500e12c5fbbb934c7debc9dc84dd1d7d1300dc..fe55b28d3725b48ed48e5fcdab52902592aa2d4e 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) return -EFAULT; local_irq_save(flags); oldval = *addr; - *addr = 1; + if (!oldval) + *addr = 1; local_irq_restore(flags); return oldval; } @@ -59,7 +60,8 @@ asmlinkage int sys_tas(int *addr) _raw_spin_lock(&tas_lock); oldval = *addr; - *addr = 1; + if (!oldval) + *addr = 1; _raw_spin_unlock(&tas_lock); return oldval;