[PATCH] reservation: sprinkle some WARN_ON()s
Rob Clark
robdclark at gmail.com
Fri Apr 8 00:52:56 UTC 2016
A bit overkill since, for example, the rcu_dereference_protected() in
reservation_object_get_list() will WARN. But this is much less subtle
for folks reading the code.
v2: use reservation_object_held() instead of ww_mutex_is_locked()
Signed-off-by: Rob Clark <robdclark at gmail.com>
---
drivers/dma-buf/reservation.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index c0bd572..439af82 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -52,6 +52,8 @@ int reservation_object_reserve_shared(struct reservation_object *obj)
struct reservation_object_list *fobj, *old;
u32 max;
+ WARN_ON(!reservation_object_held(obj));
+
old = reservation_object_get_list(obj);
if (old && old->shared_max) {
@@ -189,6 +191,8 @@ void reservation_object_add_shared_fence(struct reservation_object *obj,
{
struct reservation_object_list *old, *fobj = obj->staged;
+ WARN_ON(!reservation_object_held(obj));
+
old = reservation_object_get_list(obj);
obj->staged = NULL;
@@ -207,6 +211,8 @@ void reservation_object_add_excl_fence(struct reservation_object *obj,
struct reservation_object_list *old;
u32 i = 0;
+ WARN_ON(!reservation_object_held(obj));
+
old = reservation_object_get_list(obj);
if (old)
i = old->shared_count;
--
2.5.5
More information about the dri-devel
mailing list