locking: use a cull hook to handle dma_resv_lock()
commit8fbc50214f58cfa7981dede670585c1636a030dd
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 24 Jul 2024 18:54:53 +0000 (24 13:54 -0500)
committerDan Carpenter <dan.carpenter@linaro.org>
Wed, 24 Jul 2024 18:54:53 +0000 (24 13:54 -0500)
tree442ee5f94cad386ec6f2b68080d1362fe0a5073e
parent7219d4ec872d9dea9dd6d404448f542075302bf5
locking: use a cull hook to handle dma_resv_lock()

The thing about dma_resv_lock() is that if you pass a NULL ctx then
it can't fail.  Smatch knows that we don't take the lock on the failure
path, but not that it can't fail.  Most callers, when they pass a NULL,
then they don't check for failure and Smatch is like "Wait, are we holding
the lock or not?".

So at first I changed it to say that "We take the lock on the failure
path as well".  And that works for most things because they don't
check for failure and Smatch is no longer confused, "Yes.  We're holding
the lock.  Fine."

But the problem arises because some callers *do* check for failure and
now Smatch is like, "Wait, we forgot to drop the lock on that path."

So the real fix is to say, "If the ctx is NULL then we can't fail".  The
difficulty with this approach is that I had to create the cull hook
infrastructure first.  But that's done now.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
check_locking.c