Skip to content

Commit

Permalink
net: moxa: fix endianness-related issues from 'sparse'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sergei Antonov authored and Paolo Abeni committed Sep 6, 2022
1 parent 9df696b commit 03fdb11
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/moxa/moxart_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@

#include "moxart_ether.h"

static inline void moxart_desc_write(u32 data, u32 *desc)
static inline void moxart_desc_write(u32 data, __le32 *desc)
{
*desc = cpu_to_le32(data);
}

static inline u32 moxart_desc_read(u32 *desc)
static inline u32 moxart_desc_read(__le32 *desc)
{
return le32_to_cpu(*desc);
}
Expand Down

0 comments on commit 03fdb11

Please sign in to comment.