All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk+kernel@arm.linux.org.uk>
To: netdev@vger.kernel.org
Cc: Rasesh Mody <rmody@brocade.com>
Subject: [PATCH 1/7] NET: brocade/bna/bnad.c: fix 32-bit DMA mask handling
Date: Tue, 11 Jun 2013 00:09:42 +0100	[thread overview]
Message-ID: <E1UmBDa-0006Jt-CE@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20130610230849.GF18614@n2100.arm.linux.org.uk>

The fallback to 32-bit DMA mask is rather odd:
	if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)) &&
	    !dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64))) {
		*using_dac = true;
	} else {
		err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
		if (err) {
			err = dma_set_coherent_mask(&pdev->dev,
						    DMA_BIT_MASK(32));
			if (err)
				goto release_regions;
		}

This means we only try and set the coherent DMA mask if we failed to
set a 32-bit DMA mask, and only if both fail do we fail the driver.
Adjust this so that if either setting fails, we fail the driver - and
thereby end up properly setting both the DMA mask and the coherent
DMA mask in the fallback case.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/net/ethernet/brocade/bna/bnad.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index 07f7ef0..15feb8b 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -3302,12 +3302,11 @@ bnad_pci_init(struct bnad *bnad,
 		*using_dac = true;
 	} else {
 		err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
-		if (err) {
+		if (!err)
 			err = dma_set_coherent_mask(&pdev->dev,
 						    DMA_BIT_MASK(32));
-			if (err)
-				goto release_regions;
-		}
+		if (err)
+			goto release_regions;
 		*using_dac = false;
 	}
 	pci_set_master(pdev);
-- 
1.7.4.4

  reply	other threads:[~2013-06-10 23:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 23:08 [RFC 0/7] Fixing dma mask setting in various network drivers Russell King - ARM Linux
2013-06-10 23:09 ` Russell King [this message]
2013-06-10 23:10 ` [PATCH 2/7] NET: intel/e1000e/netdev.c: fix 32-bit DMA mask handling Russell King
2013-06-10 23:27   ` Jeff Kirsher
2013-06-10 23:11 ` [PATCH 3/7] NET: intel/igb/igb_main.c: " Russell King
2013-06-10 23:27   ` Jeff Kirsher
2013-06-10 23:12 ` [PATCH 4/7] NET: intel/igbvf/netdev.c: " Russell King
2013-06-10 23:27   ` Jeff Kirsher
2013-06-10 23:13 ` [PATCH 5/7] NET: intel/ixgb/ixgb_main.c: " Russell King
2013-06-10 23:27   ` Jeff Kirsher
2013-06-10 23:14 ` [PATCH 6/7] NET: intel/ixgbe/ixgbe_main.c: " Russell King
2013-06-10 23:28   ` Jeff Kirsher
2013-06-10 23:15 ` [PATCH 7/7] NET: intel/ixgbevf/ixgbevf_main.c: " Russell King
2013-06-10 23:28   ` Jeff Kirsher
2013-06-11 18:12 ` [RFC 0/7] Fixing dma mask setting in various network drivers Jesse Brandeburg
2013-06-11 20:35   ` Russell King - ARM Linux
2013-06-11 23:50     ` Jesse Brandeburg
2013-06-12  0:01       ` Russell King - ARM Linux
2013-06-17 14:01   ` Russell King - ARM Linux
2013-06-17 20:35     ` Jeff Kirsher
2013-06-17 20:45       ` Russell King - ARM Linux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1UmBDa-0006Jt-CE@rmk-PC.arm.linux.org.uk \
    --to=rmk+kernel@arm.linux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=rmody@brocade.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.