diff options
author | Nathan Chancellor <[email protected]> | 2024-02-05 12:49:53 -0700 |
---|---|---|
committer | Kalle Valo <[email protected]> | 2024-02-07 17:08:07 +0200 |
commit | 04edb5dc68f4356fd8df44c04547a729dc44f43e (patch) | |
tree | ffeac696e77c3042a7b67b7a8c89fea2bf79e12e | |
parent | d7a5c7cde2cb6b5d83e1c95892d6bc4650c0a3a2 (diff) |
wifi: ath12k: Fix uninitialized use of ret in ath12k_mac_allocate()
Clang warns (or errors with CONFIG_WERROR=y):
drivers/net/wireless/ath/ath12k/mac.c:8060:9: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
8060 | return ret;
| ^~~
drivers/net/wireless/ath/ath12k/mac.c:8022:9: note: initialize the variable 'ret' to silence this warning
8022 | int ret, i, j;
| ^
| = 0
1 error generated.
Commit 6db6e70a17f6 ("wifi: ath12k: Introduce the container for mac80211
hw") added a completely uninitialized use of ret. Prior to that change,
-ENOMEM was returned to the callers of ath12k_mac_allocate() whenever
ath12k_mac_hw_allocate() failed. Assign that value to ret to make sure
it is always initialized when used and clear up the warning.
Closes: https://github.com/ClangBuiltLinux/linux/issues/1989i
Fixes: 6db6e70a17f6 ("wifi: ath12k: Introduce the container for mac80211 hw")
Signed-off-by: Nathan Chancellor <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://msgid.link/[email protected]
-rw-r--r-- | drivers/net/wireless/ath/ath12k/mac.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index a3b002d77a07..a737a09a0b9c 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -8302,6 +8302,7 @@ int ath12k_mac_allocate(struct ath12k_base *ab) if (!ah) { ath12k_warn(ab, "failed to allocate mac80211 hw device for hw_idx %d\n", i); + ret = -ENOMEM; goto err; } |