* [PATCH v2 net] net/sonic: use dma_mapping_error() for error check
@ 2023-03-21 3:45 Finn Thain
2023-03-21 8:19 ` Leon Romanovsky
2023-03-22 4:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Finn Thain @ 2023-03-21 3:45 UTC (permalink / raw)
To: Thomas Bogendoerfer, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, Zhang Changzhong
From: Zhang Changzhong <zhangchangzhong@huawei.com>
The DMA address returned by dma_map_single() should be checked with
dma_mapping_error(). Fix it accordingly.
Fixes: efcce839360f ("[PATCH] macsonic/jazzsonic network drivers update")
Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
---
This was originally Zhang Changzhong's patch. I've just added the missing
curly bracket which caused a build failure when the patch was first posted.
---
drivers/net/ethernet/natsemi/sonic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/natsemi/sonic.c b/drivers/net/ethernet/natsemi/sonic.c
index d17d1b4f2585..825356ee3492 100644
--- a/drivers/net/ethernet/natsemi/sonic.c
+++ b/drivers/net/ethernet/natsemi/sonic.c
@@ -292,7 +292,7 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
*/
laddr = dma_map_single(lp->device, skb->data, length, DMA_TO_DEVICE);
- if (!laddr) {
+ if (dma_mapping_error(lp->device, laddr)) {
pr_err_ratelimited("%s: failed to map tx DMA buffer.\n", dev->name);
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
@@ -509,7 +509,7 @@ static bool sonic_alloc_rb(struct net_device *dev, struct sonic_local *lp,
*new_addr = dma_map_single(lp->device, skb_put(*new_skb, SONIC_RBSIZE),
SONIC_RBSIZE, DMA_FROM_DEVICE);
- if (!*new_addr) {
+ if (dma_mapping_error(lp->device, *new_addr)) {
dev_kfree_skb(*new_skb);
*new_skb = NULL;
return false;
--
2.37.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 net] net/sonic: use dma_mapping_error() for error check
2023-03-21 3:45 [PATCH v2 net] net/sonic: use dma_mapping_error() for error check Finn Thain
@ 2023-03-21 8:19 ` Leon Romanovsky
2023-03-22 4:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2023-03-21 8:19 UTC (permalink / raw)
To: Finn Thain
Cc: Thomas Bogendoerfer, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
Zhang Changzhong
On Tue, Mar 21, 2023 at 02:45:43PM +1100, Finn Thain wrote:
> From: Zhang Changzhong <zhangchangzhong@huawei.com>
>
> The DMA address returned by dma_map_single() should be checked with
> dma_mapping_error(). Fix it accordingly.
>
> Fixes: efcce839360f ("[PATCH] macsonic/jazzsonic network drivers update")
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
> Tested-by: Stan Johnson <userm57@yahoo.com>
> Signed-off-by: Finn Thain <fthain@linux-m68k.org>
> ---
> This was originally Zhang Changzhong's patch. I've just added the missing
> curly bracket which caused a build failure when the patch was first posted.
> ---
> drivers/net/ethernet/natsemi/sonic.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 net] net/sonic: use dma_mapping_error() for error check
2023-03-21 3:45 [PATCH v2 net] net/sonic: use dma_mapping_error() for error check Finn Thain
2023-03-21 8:19 ` Leon Romanovsky
@ 2023-03-22 4:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-22 4:40 UTC (permalink / raw)
To: Finn Thain
Cc: tsbogend, davem, edumazet, kuba, pabeni, netdev, linux-kernel,
zhangchangzhong
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 21 Mar 2023 14:45:43 +1100 you wrote:
> From: Zhang Changzhong <zhangchangzhong@huawei.com>
>
> The DMA address returned by dma_map_single() should be checked with
> dma_mapping_error(). Fix it accordingly.
>
> Fixes: efcce839360f ("[PATCH] macsonic/jazzsonic network drivers update")
> Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com>
> Tested-by: Stan Johnson <userm57@yahoo.com>
> Signed-off-by: Finn Thain <fthain@linux-m68k.org>
>
> [...]
Here is the summary with links:
- [v2,net] net/sonic: use dma_mapping_error() for error check
https://git.kernel.org/netdev/net/c/4107b8746d93
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-22 4:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-21 3:45 [PATCH v2 net] net/sonic: use dma_mapping_error() for error check Finn Thain
2023-03-21 8:19 ` Leon Romanovsky
2023-03-22 4:40 ` patchwork-bot+netdevbpf
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).