* [PATCH RESEND v3] 3c59x: fix bad split of cpu_to_le32(pci_map_single())
@ 2014-10-07 13:40 Sylvain 'ythier' Hitier
2014-10-07 17:16 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Sylvain 'ythier' Hitier @ 2014-10-07 13:40 UTC (permalink / raw)
To: linux-kernel; +Cc: nhorman, mroos, David Miller, netdev, Steffen Klassert
From: Sylvain "ythier" Hitier <sylvain.hitier@gmail.com>
In commit 6f2b6a3005b2c34c39f207a87667564f64f2f91a,
# 3c59x: Add dma error checking and recovery
the intent is to split out the mapping from the byte-swapping in order to
insert a dma_mapping_error() check.
Kinda this semantic patch:
// See http://coccinelle.lip6.fr/
//
// Beware, grouik-and-dirty!
@@
expression DEV, X, Y, Z;
@@
- cpu_to_le32(pci_map_single(DEV, X, Y, Z))
+ dma_addr_t addr = pci_map_single(DEV, X, Y, Z);
+ if (dma_mapping_error(&DEV->dev, addr))
+ /* snip */;
+ cpu_to_le32(addr)
However, the #else part (of the #if DO_ZEROCOPY test) is changed this way:
- cpu_to_le32(pci_map_single(DEV, X, Y, Z))
+ dma_addr_t addr = cpu_to_le32(pci_map_single(DEV, X, Y, Z));
// ^^^^^^^^^^^
// That mismatches the 3 other changes!
+ if (dma_mapping_error(&DEV->dev, addr))
+ /* snip */;
+ cpu_to_le32(addr)
Let's remove the leftover cpu_to_le32() for coherency.
v2: Better changelog.
v3: Add Acked-by
Fixes: 6f2b6a3005b2c34c39f207a87667564f64f2f91a
# 3c59x: Add dma error checking and recovery
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Sylvain "ythier" Hitier <sylvain.hitier@gmail.com>
---
[Resent with maintainer and mailing-list Cc-ed]
drivers/net/ethernet/3com/3c59x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index 8ca49f04..0a3108b3 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -2214,7 +2214,7 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev)
}
}
#else
- dma_addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, PCI_DMA_TODEVICE));
+ dma_addr = pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, PCI_DMA_TODEVICE);
if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr))
goto out_dma_err;
vp->tx_ring[entry].addr = cpu_to_le32(dma_addr);
--
1.7.10.4
Regards,
Sylvain "ythier" Hitier
--
Business is about being busy, not being rich...
Lived 777 days in a Debian package => http://en.wikipedia.org/wiki/Apt,_Vaucluse
There's THE room for ideals in this mechanical place!
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH RESEND v3] 3c59x: fix bad split of cpu_to_le32(pci_map_single())
2014-10-07 13:40 [PATCH RESEND v3] 3c59x: fix bad split of cpu_to_le32(pci_map_single()) Sylvain 'ythier' Hitier
@ 2014-10-07 17:16 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-10-07 17:16 UTC (permalink / raw)
To: sylvain.hitier; +Cc: linux-kernel, nhorman, mroos, netdev, klassert
From: Sylvain 'ythier' Hitier <sylvain.hitier@gmail.com>
Date: Tue, 7 Oct 2014 13:40:34 +0000
> From: Sylvain "ythier" Hitier <sylvain.hitier@gmail.com>
>
> In commit 6f2b6a3005b2c34c39f207a87667564f64f2f91a,
> # 3c59x: Add dma error checking and recovery
> the intent is to split out the mapping from the byte-swapping in order to
> insert a dma_mapping_error() check.
>
> Kinda this semantic patch:
>
> // See http://coccinelle.lip6.fr/
> //
> // Beware, grouik-and-dirty!
> @@
> expression DEV, X, Y, Z;
> @@
> - cpu_to_le32(pci_map_single(DEV, X, Y, Z))
> + dma_addr_t addr = pci_map_single(DEV, X, Y, Z);
> + if (dma_mapping_error(&DEV->dev, addr))
> + /* snip */;
> + cpu_to_le32(addr)
>
> However, the #else part (of the #if DO_ZEROCOPY test) is changed this way:
>
> - cpu_to_le32(pci_map_single(DEV, X, Y, Z))
> + dma_addr_t addr = cpu_to_le32(pci_map_single(DEV, X, Y, Z));
> // ^^^^^^^^^^^
> // That mismatches the 3 other changes!
> + if (dma_mapping_error(&DEV->dev, addr))
> + /* snip */;
> + cpu_to_le32(addr)
>
> Let's remove the leftover cpu_to_le32() for coherency.
>
> v2: Better changelog.
> v3: Add Acked-by
>
> Fixes: 6f2b6a3005b2c34c39f207a87667564f64f2f91a
> # 3c59x: Add dma error checking and recovery
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> Signed-off-by: Sylvain "ythier" Hitier <sylvain.hitier@gmail.com>
Applied and queued up for -stable, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-07 17:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-07 13:40 [PATCH RESEND v3] 3c59x: fix bad split of cpu_to_le32(pci_map_single()) Sylvain 'ythier' Hitier
2014-10-07 17:16 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).