All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] locking/ww_mutex: set ret variable on failure
@ 2021-09-27 14:57 trix
  2021-10-11 11:16 ` Will Deacon
  0 siblings, 1 reply; 2+ messages in thread
From: trix @ 2021-09-27 14:57 UTC (permalink / raw)
  To: peterz, mingo, will, longman, boqun.feng, nathan, ndesaulniers
  Cc: linux-kernel, llvm, Tom Rix

From: Tom Rix <trix@redhat.com>

Building with clang 13 produces this error
test-ww_mutex.c:138:7: error: variable 'ret' is used
  uninitialized whenever 'if' condition is true
  [-Werror,-Wsometimes-uninitialized]
                if (!ww_mutex_trylock(&mutex, &ctx)) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On this failure set ret to -EINVAL as is similarly done
in the function.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 kernel/locking/test-ww_mutex.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/locking/test-ww_mutex.c b/kernel/locking/test-ww_mutex.c
index d63ac411f36722..7dbac5dc02efb7 100644
--- a/kernel/locking/test-ww_mutex.c
+++ b/kernel/locking/test-ww_mutex.c
@@ -137,6 +137,7 @@ static int test_aa(bool trylock)
 	} else {
 		if (!ww_mutex_trylock(&mutex, &ctx)) {
 			pr_err("%s: initial trylock failed!\n", __func__);
+			ret = -EINVAL;
 			goto out;
 		}
 	}
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-11 11:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 14:57 [PATCH] locking/ww_mutex: set ret variable on failure trix
2021-10-11 11:16 ` Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.