Skip to contentSkip to conversation

net: bgmac: Couple of sparse warnings

PATCH In review Florian Fainelli 3 participants 8 messages Apr 1, 2018 – Apr 5, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover net: bgmac: Couple of sparse warnings

Hi all,

This patch series fixes a couple of warnings reported by sparse, should not cause any functional problems since bgmac is typically used on LE platforms anyway.

Florian Fainelli (2):
net: bgmac: Correctly annotate register space
net: bgmac: Fix endian access in bgmac_dma_tx_ring_free()

 drivers/net/ethernet/broadcom/bgmac.c | 3 ++-
 drivers/net/ethernet/broadcom/bgmac.h | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/2 net: bgmac: Correctly annotate register space

All the members: base, idm_base and nicpm_base should be annotated with __iomem since they are pointers to register space. This fixes a bunch of sparse reported warnings.

Fixes f6a95a24957a ("net: ethernet: bgmac: Add platform device support")
Fixes dd5c5d037f5e ("net: ethernet: bgmac: add NS2 support")
---
 drivers/net/ethernet/broadcom/bgmac.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bgmac.h +3 -3
index 4040d846da8e..40d02fec2747 100644
@@ -479,9 +479,9 @@ struct bgmac_rx_header {
 struct bgmac {
 	union {
 		struct {
-			void *base;
-			void *idm_base;
-			void *nicpm_base;
+			void __iomem *base;
+			void __iomem *idm_base;
+			void __iomem *nicpm_base;
 		} plat;
 		struct {
 			struct bcma_device *core;
Signature · 1 line
2.14.1
#2 lore raw

Re: [PATCH net 1/2] net: bgmac: Correctly annotate register space

Hi Florian Fainelli.

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag. fixing commit: f6a95a24957a net: ethernet: bgmac: Add platform device support.

The bot has also determined it's probably a bug fixing patch. (score: 67.8237)

The bot has tested the following trees: v4.15.15, v4.14.32, v4.9.92,

v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Failed to apply! Possible dependencies:
dd5c5d037f5e: ("net: ethernet: bgmac: add NS2 support") 1676aba5ef7e: ("net: ethernet: bgmac: device tree phy enablement")

#3 lore raw

PATCH 2/2 net: bgmac: Fix endian access in bgmac_dma_tx_ring_free()

In reply to Florian Fainelli

bgmac_dma_tx_ring_free() assigns the ctl1 word which is a litle endian 32-bit word without using proper accessors, fix this, and because a length cannot be negative, use unsigned int while at it.

Fixes 9cde94506eac ("bgmac: implement scatter/gather support")
---
 drivers/net/ethernet/broadcom/bgmac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bgmac.c +2 -1
index 8eef9fb6b1fe..ad8195b0d161 100644
@@ -533,7 +533,8 @@ static void bgmac_dma_tx_ring_free(struct bgmac *bgmac,
 	int i;
 
 	for (i = 0; i < BGMAC_TX_RING_SLOTS; i++) {
-		int len = dma_desc[i].ctl1 & BGMAC_DESC_CTL1_LEN;
+		u32 ctl1 = le32_to_cpu(dma_desc[i].ctl1);
+		unsigned int len = ctl1 & BGMAC_DESC_CTL1_LEN;
 
 		slot = &ring->slots[i];
 		dev_kfree_skb(slot->skb);
Signature · 1 line
2.14.1
#4 lore raw

Re: [PATCH net 2/2] net: bgmac: Fix endian access in bgmac_dma_tx_ring_free()

Hi Florian Fainelli.

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag. fixing commit: 9cde94506eac bgmac: implement scatter/gather support.

The bot has also determined it's probably a bug fixing patch. (score: 45.9160)

The bot has tested the following trees: v4.15.15, v4.14.32, v4.9.92, v4.4.126,

v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Build OK!

maintainer
#5 lore raw
In reply to Florian Fainelli

From: Florian Fainelli <[email protected]>
Date: Sun, 1 Apr 2018 10:26:28 -0700

Quoted 3 lines

This patch series fixes a couple of warnings reported by sparse, should not cause any functional problems since bgmac is typically used on LE platforms anyway.

Series applied, thanks Florian.

#6 lore raw
Quoted 8 lines · David Miller

From: Florian Fainelli <[email protected]>
Date: Sun, 1 Apr 2018 10:26:28 -0700

Quoted 3 lines

This patch series fixes a couple of warnings reported by sparse, should not cause any functional problems since bgmac is typically used on LE platforms anyway.

Series applied, thanks Florian.

I did not see this in net/master or included in your recent pull request to Linus, not a big deal, but I just want to make sure this is not lost somewhere ;)

Signature · 1 line
Florian
maintainer
#7 lore raw

From: Florian Fainelli <[email protected]>
Date: Mon, 2 Apr 2018 10:17:36 -0700

Quoted 8 lines · David Miller
Quoted 7 lines

From: Florian Fainelli <[email protected]>
Date: Sun, 1 Apr 2018 10:26:28 -0700

Quoted 3 lines

This patch series fixes a couple of warnings reported by sparse, should not cause any functional problems since bgmac is typically used on LE platforms anyway.

Quoted 5 lines
Quoted 1 line

Series applied, thanks Florian.

I did not see this in net/master or included in your recent pull request to Linus, not a big deal, but I just want to make sure this is not lost somewhere ;)

All changes go into net-next as I prepare for a merge window pull request.