]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: spider_net: Fix the size used in a 'dma_free_coherent()' call
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 2 Aug 2020 13:53:33 +0000 (15:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 08:53:02 +0000 (10:53 +0200)
[ Upstream commit 36f28f7687a9ce665479cce5d64ce7afaa9e77ae ]

Update the size used in 'dma_free_coherent()' in order to match the one
used in the corresponding 'dma_alloc_coherent()', in
'spider_net_init_chain()'.

Fixes: d4ed8f8d1fb7 ("Spidernet DMA coalescing")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/toshiba/spider_net.c

index 8e53211aedd8274862b09a1f5d36b816f93e9eba..53600e28d93b7e6b438900a963d850bfefa57f16 100644 (file)
@@ -297,8 +297,8 @@ spider_net_free_chain(struct spider_net_card *card,
                descr = descr->next;
        } while (descr != chain->ring);
 
-       dma_free_coherent(&card->pdev->dev, chain->num_desc,
-           chain->hwring, chain->dma_addr);
+       dma_free_coherent(&card->pdev->dev, chain->num_desc * sizeof(struct spider_net_hw_descr),
+                         chain->hwring, chain->dma_addr);
 }
 
 /**