All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] i40e: i40evf: fix error checking path
@ 2014-03-23 20:26 Jean Sacren
  2014-03-24 20:21 ` Jeff Kirsher
  0 siblings, 1 reply; 2+ messages in thread
From: Jean Sacren @ 2014-03-23 20:26 UTC (permalink / raw)
  To: Jeff Kirsher; +Cc: e1000-devel, netdev, Mitch Williams

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.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
Cc: Mitch Williams <mitch.a.williams@intel.com>
---
 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(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 113354214517..37b2f55ea43b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -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 */
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index d381bcc4ea9f..fdf9edf97ff1 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] i40e: i40evf: fix error checking path
  2014-03-23 20:26 [PATCH net-next] i40e: i40evf: fix error checking path Jean Sacren
@ 2014-03-24 20:21 ` Jeff Kirsher
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Kirsher @ 2014-03-24 20:21 UTC (permalink / raw)
  To: Jean Sacren; +Cc: e1000-devel, netdev, Mitch


[-- Attachment #1.1: Type: text/plain, Size: 857 bytes --]

On Sun, 2014-03-23 at 14:26 -0600, Jean Sacren wrote:
> 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.
> 
> Signed-off-by: Jean Sacren <sakiwit@gmail.com>
> Cc: Mitch Williams <mitch.a.williams@intel.com>
> ---
>  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.

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 370 bytes --]

------------------------------------------------------------------------------
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

[-- Attachment #3: Type: text/plain, Size: 257 bytes --]

_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-24 20:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-23 20:26 [PATCH net-next] i40e: i40evf: fix error checking path Jean Sacren
2014-03-24 20:21 ` Jeff Kirsher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.