net: octeontx2: Restore default value for err
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Tue, 5 Aug 2025 14:53:34 +0000 (15:53 +0100)
committerJerome Forissier <jerome.forissier@linaro.org>
Mon, 18 Aug 2025 13:47:57 +0000 (15:47 +0200)
In nix_lf_setup there is a default value assigned to err in case an
error is detected. However this default value will be overwritten in the
for loop so that later code does not return an error code from the
function. Add a new assignment to restore err to the default error code.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/net/octeontx2/nix.c

index f596b6b..87d1f7a 100644 (file)
@@ -298,6 +298,8 @@ int nix_lf_setup(struct nix *nix)
                        goto error;
        }
 
+       err = -1;
+
        /* Alloc memory for Qints HW contexts */
        nix->qint_base = nix_memalloc(nix_af->qints, nix_af->qint_ctx_sz,
                                      "Qint CTX");