[PATCH libdrm] atomic: fix atomic_add_unless() fallback's return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



According to the kernel documentation:
  Returns non-zero if @v was not @u, and zero otherwise.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100077
Fixes: 63fc571863aa64683400 ("atomic: add atomic_add_unless()")
Signed-off-by: David Shao <davshao@xxxxxxxxx>
Reviewed-by: Eric Engestrom <eric@xxxxxxxxxxxx>
Signed-off-by: Eric Engestrom <eric@xxxxxxxxxxxx>
---
 xf86atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xf86atomic.h b/xf86atomic.h
index 922b37da..ecb1ba86 100644
--- a/xf86atomic.h
+++ b/xf86atomic.h
@@ -111,7 +111,7 @@ static inline int atomic_add_unless(atomic_t *v, int add, int unless)
 	c = atomic_read(v);
 	while (c != unless && (old = atomic_cmpxchg(v, c, c + add)) != c)
 		c = old;
-	return c == unless;
+	return c != unless;
 }
 
 #endif
-- 
Cheers,
  Eric

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux