diff options
author | Ivan Vecera <ivecera@redhat.com> | 2014-01-15 05:11:34 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-15 19:50:32 -0500 |
commit | ba42fad0964a41f0830e80c1b6be49c1e6bfcc01 (patch) | |
tree | 1855dfebb3c7f90e843895adbc9485808a5eb095 | |
parent | d9aee591b0f06bd44cd577b757d3f267bc35fe4d (diff) |
be2net: add dma_mapping_error() check for dma_map_page()
The driver does not check value returned by dma_map_page. The patch
fixes this.
v2: Removed the bugfix for non-bug ;-) (thanks Sathya)
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Acked-by: Sathya Perla <Sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index bf40fdaecfa3..a37039d353c5 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -1776,6 +1776,7 @@ static void be_post_rx_frags(struct be_rx_obj *rxo, gfp_t gfp) | |||
1776 | struct be_rx_page_info *page_info = NULL, *prev_page_info = NULL; | 1776 | struct be_rx_page_info *page_info = NULL, *prev_page_info = NULL; |
1777 | struct be_queue_info *rxq = &rxo->q; | 1777 | struct be_queue_info *rxq = &rxo->q; |
1778 | struct page *pagep = NULL; | 1778 | struct page *pagep = NULL; |
1779 | struct device *dev = &adapter->pdev->dev; | ||
1779 | struct be_eth_rx_d *rxd; | 1780 | struct be_eth_rx_d *rxd; |
1780 | u64 page_dmaaddr = 0, frag_dmaaddr; | 1781 | u64 page_dmaaddr = 0, frag_dmaaddr; |
1781 | u32 posted, page_offset = 0; | 1782 | u32 posted, page_offset = 0; |
@@ -1788,9 +1789,15 @@ static void be_post_rx_frags(struct be_rx_obj *rxo, gfp_t gfp) | |||
1788 | rx_stats(rxo)->rx_post_fail++; | 1789 | rx_stats(rxo)->rx_post_fail++; |
1789 | break; | 1790 | break; |
1790 | } | 1791 | } |
1791 | page_dmaaddr = dma_map_page(&adapter->pdev->dev, pagep, | 1792 | page_dmaaddr = dma_map_page(dev, pagep, 0, |
1792 | 0, adapter->big_page_size, | 1793 | adapter->big_page_size, |
1793 | DMA_FROM_DEVICE); | 1794 | DMA_FROM_DEVICE); |
1795 | if (dma_mapping_error(dev, page_dmaaddr)) { | ||
1796 | put_page(pagep); | ||
1797 | pagep = NULL; | ||
1798 | rx_stats(rxo)->rx_post_fail++; | ||
1799 | break; | ||
1800 | } | ||
1794 | page_info->page_offset = 0; | 1801 | page_info->page_offset = 0; |
1795 | } else { | 1802 | } else { |
1796 | get_page(pagep); | 1803 | get_page(pagep); |