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

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

Sparse found a number of endianness-related issues of these kinds:

.../ftmac100.c:192:32: warning: restricted __le32 degrades to integer

.../ftmac100.c:208:23: warning: incorrect type in assignment (different base types)
.../ftmac100.c:208:23: expected unsigned int rxdes0
.../ftmac100.c:208:23: got restricted __le32 [usertype]

.../ftmac100.c:249:23: warning: invalid assignment: &=
.../ftmac100.c:249:23: left side has type unsigned int
.../ftmac100.c:249:23: right side has type restricted __le32

.../ftmac100.c:527:16: warning: cast to restricted __le32

Change type of some fields from 'unsigned int' to '__le32' to fix it.

Signed-off-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20220902113749.1408562-1-saproj@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Sergei Antonov and committed by
Paolo Abeni
9df696b3 d5edc797

+6 -6
+6 -6
drivers/net/ethernet/faraday/ftmac100.h
··· 122 122 * Transmit descriptor, aligned to 16 bytes 123 123 */ 124 124 struct ftmac100_txdes { 125 - unsigned int txdes0; 126 - unsigned int txdes1; 127 - unsigned int txdes2; /* TXBUF_BADR */ 125 + __le32 txdes0; 126 + __le32 txdes1; 127 + __le32 txdes2; /* TXBUF_BADR */ 128 128 unsigned int txdes3; /* not used by HW */ 129 129 } __attribute__ ((aligned(16))); 130 130 ··· 143 143 * Receive descriptor, aligned to 16 bytes 144 144 */ 145 145 struct ftmac100_rxdes { 146 - unsigned int rxdes0; 147 - unsigned int rxdes1; 148 - unsigned int rxdes2; /* RXBUF_BADR */ 146 + __le32 rxdes0; 147 + __le32 rxdes1; 148 + __le32 rxdes2; /* RXBUF_BADR */ 149 149 unsigned int rxdes3; /* not used by HW */ 150 150 } __attribute__ ((aligned(16))); 151 151