This error is seen in build of type "minsize":
drivers/net/nfp/nfpcore/nfp_elf.c:920:35: error:
'sh_type' may be used uninitialized [-Werror=maybe-uninitialized]
It looks to be a compiler issue because sh_type is only read
after a section was found in the loop.
The variable is initialized to allow compiling with "minsize" option.
Fixes: c82ca09c441c ("net/nfp: add ELF module")
Signed-off-by: Cheryl Bansal <[email protected]>
---
drivers/net/nfp/nfpcore/nfp_elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfpcore/nfp_elf.c
b/drivers/net/nfp/nfpcore/nfp_elf.c
index 522b025f92..549bb7a922 100644
--- a/drivers/net/nfp/nfpcore/nfp_elf.c
+++ b/drivers/net/nfp/nfpcore/nfp_elf.c
@@ -899,7 +899,7 @@ static int
nfp_elf_read_first_symtab(struct nfp_elf *ectx)
{
size_t idx;
- uint32_t sh_type;
+ uint32_t sh_type = 0;
uint64_t sh_size;
struct nfp_elf_elf64_shdr *sec = NULL;
--
2.43.0