[PATCH 2/2] unwind: Fix return value for already-queued case in unwind_deferred_request()

Josh Poimboeuf posted 2 patches 4 days, 4 hours ago
[PATCH 2/2] unwind: Fix return value for already-queued case in unwind_deferred_request()
Posted by Josh Poimboeuf 4 days, 4 hours ago
The unwind_deferred_request() return value is documented in the function
header:

  * Return: 0 if the callback successfully was queued.
  *         1 if the callback is pending or was already executed.
  *         Negative if there's an error.

However, when the callback is already queued, it may return a non-1
value.  Fix it to match the documented behavior.

Fixes: be3d526a5b34 ("unwind deferred: Use bitmask to determine which callbacks to call")
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 kernel/unwind/deferred.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/unwind/deferred.c b/kernel/unwind/deferred.c
index 416af9b98bad..edf39c61130a 100644
--- a/kernel/unwind/deferred.c
+++ b/kernel/unwind/deferred.c
@@ -282,7 +282,7 @@ int unwind_deferred_request(struct unwind_work *work, u64 *cookie)
 		 * have also set pending and queued a callback.
 		 */
 		WARN_ON_ONCE(!(old_mask & UNWIND_PENDING));
-		return old_mask & bit_mask;
+		return !!(old_mask & bit_mask);
 	}
 
 	/* The work has been claimed, now schedule it. */
-- 
2.52.0