i40e: fix dma alloc/free prototypes
Subsystems (3)
PATCH 1/1 i40e: fix dma alloc/free prototypes
From: Arnd Bergmann <[email protected]>
gcc-13 notices a mismatch between the declaration and the definition for a few functions that apparently used to return a i40e_status_code instead of an int:
drivers/net/ethernet/intel/i40e/i40e_main.c:129:5: error: conflicting types for 'i40e_allocate_dma_mem_d' due to enum/integer mismatch; have 'int(struct i40e_hw *, struct i40e_dma_mem *, u64, u32)' {aka 'int(struct i40e_hw *, struct i40e_dma_mem *, long long unsigned int, unsigned int)'} [-Werror=enum-int-mismatch]
129 | int i40e_allocate_dma_mem_d(struct i40e_hw *hw, struct i40e_dma_mem *mem,
| ^~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/ethernet/intel/i40e/i40e_type.h:8,
from drivers/net/ethernet/intel/i40e/i40e.h:41,
from drivers/net/ethernet/intel/i40e/i40e_main.c:12:
drivers/net/ethernet/intel/i40e/i40e_osdep.h:40:25: note: previous declaration of 'i40e_allocate_dma_mem_d' with type 'i40e_status(struct i40e_hw *, struct i40e_dma_mem *, u64, u32)' {aka 'enum i40e_status_code(struct i40e_hw *, struct i40e_dma_mem *, long long unsigned int, unsigned int)'}
40 | i40e_allocate_dma_mem_d(h, m, s, a)
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/i40e/i40e_alloc.h:23:13: note: in expansion of macro 'i40e_allocate_dma_mem'
23 | i40e_status i40e_allocate_dma_mem(struct i40e_hw *hw,
| ^~~~~~~~~~~~~~~~~~~~~Change the prototypes to match the definition.
--- drivers/net/ethernet/intel/i40e/i40e_alloc.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_alloc.h +9 -11
@@ -20,16 +20,14 @@ enum i40e_memory_type { };/* prototype for functions used for dynamic memory allocation */ -i40e_status i40e_allocate_dma_mem (struct i40e_hw *hw, -struct i40e_dma_mem *mem, -enum i40e_memory_type type, -u64 size,u32 alignment); -i40e_status i40e_free_dma_mem (struct i40e_hw *hw, -struct i40e_dma_mem *mem); -i40e_status i40e_allocate_virt_mem (struct i40e_hw *hw, -struct i40e_virt_mem *mem, -u32 size); -i40e_status i40e_free_virt_mem (struct i40e_hw *hw, -struct i40e_virt_mem *mem); +int i40e_allocate_dma_mem (struct i40e_hw *hw, +struct i40e_dma_mem *mem, +enum i40e_memory_type type, +u64 size,u32 alignment); +int i40e_free_dma_mem (struct i40e_hw *hw,struct i40e_dma_mem *mem); +int i40e_allocate_virt_mem (struct i40e_hw *hw, +struct i40e_virt_mem *mem, +u32 size); +int i40e_free_virt_mem (struct i40e_hw *hw,struct i40e_virt_mem *mem);#endif /* _I40E_ALLOC_H_ */
Signature · 6 lines
2.39.0 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tony Nguyen
maintainerQuoted 19 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
gcc-13 notices a mismatch between the declaration and the definition for a few functions that apparently used to return a
i40e_status_codeinstead of an int:
drivers/net/ethernet/intel/i40e/i40e_main.c:129:5: error: conflicting types for 'i40e_allocate_dma_mem_d' due to enum/integer mismatch; have 'int(struct i40e_hw *, struct i40e_dma_mem *, u64, u32)' {aka 'int(struct i40e_hw *, struct i40e_dma_mem *, long long unsigned int, unsigned int)'} [-Werror=enum-int-mismatch]
129 | int i40e_allocate_dma_mem_d(structi40e_hw*hw, structi40e_dma_mem*mem,| ^~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/net/ethernet/intel/i40e/i40e_type.h:8, from drivers/net/ethernet/intel/i40e/i40e.h:41, from drivers/net/ethernet/intel/i40e/i40e_main.c:12: drivers/net/ethernet/intel/i40e/i40e_osdep.h:40:25: note: previous declaration of 'i40e_allocate_dma_mem_d' with type 'i40e_status(struct i40e_hw *, struct i40e_dma_mem *, u64, u32)' {aka 'enum i40e_status_code(struct i40e_hw *, struct i40e_dma_mem *, long long unsigned int, unsigned int)'} 40 | i40e_allocate_dma_mem_d(h, m, s, a) | ^~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/intel/i40e/i40e_alloc.h:23:13: note: in expansion of macro 'i40e_allocate_dma_mem' 23 | i40e_status i40e_allocate_dma_mem(struct i40e_hw *hw, | ^~~~~~~~~~~~~~~~~~~~~
Quoted 1 line
Change the prototypes to match the definition.
Thanks for the patch Arnd, however, the problem with this is the call chain of these functions are returning i40e_status which, with the propagated values of these functions, will push the warnings up I assume. We have a series coming to remove i40e_status altogether [1] which should resolve this issue.
Thanks,
Tony
Quoted 26 lines
Fixes 56a62fc86895 ("i40e: init code and hardware support")Signed-off-by Arnd Bergmann <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_alloc.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)drivers/net/ethernet/intel/i40e/i40e_alloc.h +1
-11@@ -20,16 +20,14 @@ enum i40e_memory_type { };/* prototype for functions used for dynamic memory allocation */ -i40e_status i40e_allocate_dma_mem (struct i40e_hw *hw, -struct i40e_dma_mem *mem, -enum i40e_memory_type type, -u64 size,u32 alignment); -i40e_status i40e_free_dma_mem (struct i40e_hw *hw, -struct i40e_dma_mem *mem); -i40e_status i40e_allocate_virt_mem (struct i40e_hw *hw, -struct i40e_virt_mem *mem, -u32 size); -i40e_status i40e_free_virt_mem (struct i40e_hw *hw, -struct i40e_virt_mem *mem); +int i40e_allocate_dma_mem(struct i40e_hw *hw,
drivers/net/ethernet/intel/i40e/i40e_alloc.h enum i40e_memory_type { · line 33
Quoted 10 lines
drivers/net/ethernet/intel/i40e/i40e_alloc.h +8
-0+struct i40e_dma_mem *mem, + enum i40e_memory_type type, + u64 size, u32 alignment); +int i40e_free_dma_mem (struct i40e_hw *hw,struct i40e_dma_mem *mem); +int i40e_allocate_virt_mem (struct i40e_hw *hw, +struct i40e_virt_mem *mem, +u32 size); +int i40e_free_virt_mem (struct i40e_hw *hw,struct i40e_virt_mem *mem);#endif /* _I40E_ALLOC_H_ */
[1] https://lore.kernel.org/intel-wired-lan/[email protected]/