diff mbox series

[net-next] net: ftmac100: fix endianness-related issues from 'sparse'

Message ID 20220902113749.1408562-1-saproj@gmail.com (mailing list archive)
State Accepted
Commit 9df696b3b3a4c96c3219eb87c7bf03fb50e490b8
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: ftmac100: fix endianness-related issues from 'sparse' | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 28 this patch: 0
netdev/cc_maintainers warning 1 maintainers not CCed: kuba@kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: A patch subject line should describe the change not the tool that found it
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Sergei Antonov Sept. 2, 2022, 11:37 a.m. UTC
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>
---
 drivers/net/ethernet/faraday/ftmac100.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Andrew Lunn Sept. 6, 2022, 12:25 a.m. UTC | #1
On Fri, Sep 02, 2022 at 02:37:49PM +0300, Sergei Antonov wrote:
> 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>

    Andrew
patchwork-bot+netdevbpf@kernel.org Sept. 6, 2022, 8:50 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Fri,  2 Sep 2022 14:37:49 +0300 you wrote:
> 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]
> 
> [...]

Here is the summary with links:
  - [net-next] net: ftmac100: fix endianness-related issues from 'sparse'
    https://git.kernel.org/netdev/net-next/c/9df696b3b3a4

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/faraday/ftmac100.h b/drivers/net/ethernet/faraday/ftmac100.h
index fe986f1673fc..8af32f9070f4 100644
--- a/drivers/net/ethernet/faraday/ftmac100.h
+++ b/drivers/net/ethernet/faraday/ftmac100.h
@@ -122,9 +122,9 @@ 
  * Transmit descriptor, aligned to 16 bytes
  */
 struct ftmac100_txdes {
-	unsigned int	txdes0;
-	unsigned int	txdes1;
-	unsigned int	txdes2;	/* TXBUF_BADR */
+	__le32		txdes0;
+	__le32		txdes1;
+	__le32		txdes2;	/* TXBUF_BADR */
 	unsigned int	txdes3;	/* not used by HW */
 } __attribute__ ((aligned(16)));
 
@@ -143,9 +143,9 @@  struct ftmac100_txdes {
  * Receive descriptor, aligned to 16 bytes
  */
 struct ftmac100_rxdes {
-	unsigned int	rxdes0;
-	unsigned int	rxdes1;
-	unsigned int	rxdes2;	/* RXBUF_BADR */
+	__le32		rxdes0;
+	__le32		rxdes1;
+	__le32		rxdes2;	/* RXBUF_BADR */
 	unsigned int	rxdes3;	/* not used by HW */
 } __attribute__ ((aligned(16)));