i40e: i40evf: fix error checking path
Subsystems (3)
PATCH 1/1 i40e: i40evf: fix error checking path
The commit 6494294f277fd ("i40e/i40evf: Use dma_set_mask_and_coherent") uses dma_set_mask_and_coherent() to replace dma_set_coherent_mask() for the benefit of return error. The conversion brings some confusion in error checking as whether against DMA_BIT_MASK(64) or DMA_BIT_MASK(32). For one, if error is zero, the check will be against DMA_BIT_MASK(64) twice. Fix this error checking by binding the check to the pertinent one.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 11 ++++++----- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +6 -5
@@ -8041,12 +8041,13 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* set up for high or low dma */ err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); -if (err) - err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ));if (err) { -dev_err (&pdev->dev, -"DMA configuration failed: 0x%x\n" , err); - goto err_dma; + err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 )); +if (err) { +dev_err (&pdev->dev, +"DMA configuration failed: 0x%x\n" , err); + goto err_dma; + } }/* set up pci connections */
drivers/net/ethernet/intel/i40evf/i40evf_main.c +6 -5
@@ -2188,12 +2188,13 @@ static int i40evf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)return err; err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); -if (err) - err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ));if (err) { -dev_err (&pdev->dev, -"DMA configuration failed: 0x%x\n" , err); - goto err_dma; + err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 )); +if (err) { +dev_err (&pdev->dev, +"DMA configuration failed: 0x%x\n" , err); + goto err_dma; + } } err =pci_request_regions (pdev, i40evf_driver_name);
Quoted 8 lines · Jean Sacren
The commit
6494294f277fd("i40e/i40evf: Usedma_set_mask_and_coherent") usesdma_set_mask_and_coherent()to replacedma_set_coherent_mask()for the benefit of return error. The conversion brings some confusion in error checking as whether againstDMA_BIT_MASK(64)orDMA_BIT_MASK(32). For one, if error is zero, the check will be againstDMA_BIT_MASK(64)twice. Fix this error checking by binding the check to the pertinent one.
Quoted 6 lines
Signed-off-by Jean Sacren <[email protected]>Cc Mitch Williams <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_main.c | 11 ++++++----- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-)
Thanks Jean, I have added this to my queue.
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired