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.goodb...@linaro.org>
---
 drivers/net/octeontx2/nix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/octeontx2/nix.c b/drivers/net/octeontx2/nix.c
index f596b6bca87..87d1f7a5dbf 100644
--- a/drivers/net/octeontx2/nix.c
+++ b/drivers/net/octeontx2/nix.c
@@ -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");

-- 
2.39.5

Reply via email to