Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: moxa: fix endianness-related issues from 'sparse'

Sparse checker found two endianness-related issues:

.../moxart_ether.c:34:15: warning: incorrect type in assignment (different base types)
.../moxart_ether.c:34:15: expected unsigned int [usertype]
.../moxart_ether.c:34:15: got restricted __le32 [usertype]

.../moxart_ether.c:39:16: warning: cast to restricted __le32

Fix them by using __le32 type instead of u32.

Signed-off-by: Sergei Antonov <saproj@gmail.com>
Link: https://lore.kernel.org/r/20220902125037.1480268-1-saproj@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Sergei Antonov and committed by
Paolo Abeni
03fdb11d 9df696b3

+2 -2
+2 -2
drivers/net/ethernet/moxa/moxart_ether.c
··· 29 29 30 30 #include "moxart_ether.h" 31 31 32 - static inline void moxart_desc_write(u32 data, u32 *desc) 32 + static inline void moxart_desc_write(u32 data, __le32 *desc) 33 33 { 34 34 *desc = cpu_to_le32(data); 35 35 } 36 36 37 - static inline u32 moxart_desc_read(u32 *desc) 37 + static inline u32 moxart_desc_read(__le32 *desc) 38 38 { 39 39 return le32_to_cpu(*desc); 40 40 }