diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2010-05-25 17:32:56 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2010-05-25 17:32:56 +0000 |
commit | 18158c73a494767434033b8327273e07c57b12e8 (patch) | |
tree | 57572440ebc0ac3365f90464d81f9d152f794732 | |
parent | 8f1a0bccd11dcabac47e85d733513098d76c64b0 (diff) |
The logic in this function is a little tricky (though correct).
Explain how an invaviant is satisfied and add an assertion to check
(never hit that one). As a side benefit clang doesn't bitch about a
possible NULL deref now.
-rw-r--r-- | sys/dev/pci/drm/i915_drv.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/i915_drv.c b/sys/dev/pci/drm/i915_drv.c index f8d52605544..6801b390fe7 100644 --- a/sys/dev/pci/drm/i915_drv.c +++ b/sys/dev/pci/drm/i915_drv.c @@ -2229,6 +2229,16 @@ again: goto again; } + /* + * Here we will either have found a register in the first + * loop, or we will have waited for one and in the second case + * and thus have grabbed the object in question, freed the register + * then redone the second loop (having relocked the fence list). + * Therefore at this point it is impossible to have a null value + * in reg. + */ + KASSERT(reg != NULL); + obj_priv->fence_reg = i; reg->obj = obj; TAILQ_INSERT_TAIL(&dev_priv->mm.fence_list, reg, list); |