* [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
* Re: [PATCH] locking/ww_mutex: set ret variable on failure
2021-09-27 14:57 [PATCH] locking/ww_mutex: set ret variable on failure trix
@ 2021-10-11 11:16 ` Will Deacon
0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2021-10-11 11:16 UTC (permalink / raw)
To: trix
Cc: peterz, mingo, longman, boqun.feng, nathan, ndesaulniers,
linux-kernel, llvm
On Mon, Sep 27, 2021 at 07:57:56AM -0700, trix@redhat.com wrote:
> 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(+)
Acked-by: Will Deacon <will@kernel.org>
Will
^ permalink raw reply [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.