[PATCH] et131x: Remove useless DMA-32 fallback configuration

Christophe JAILLET posted 1 patch 4 years, 5 months ago
drivers/net/ethernet/agere/et131x.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[PATCH] et131x: Remove useless DMA-32 fallback configuration
Posted by Christophe JAILLET 4 years, 5 months ago
As stated in [1], dma_set_mask() with a 64-bit mask never fails if
dev->dma_mask is non-NULL.
So, if it fails, the 32 bits case will also fail for the same reason.

Moreover, dma_set_mask_and_coherent() returns 0 or -EIO, so the return
code of the function can be used directly. There is no need to 'rc = -EIO'
explicitly.


Simplify code and remove some dead code accordingly.

[1]: https://lkml.org/lkml/2021/6/7/398

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/agere/et131x.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/agere/et131x.c b/drivers/net/ethernet/agere/et131x.c
index f4edc616388c..537e6a85e18d 100644
--- a/drivers/net/ethernet/agere/et131x.c
+++ b/drivers/net/ethernet/agere/et131x.c
@@ -3914,10 +3914,9 @@ static int et131x_pci_setup(struct pci_dev *pdev,
 	pci_set_master(pdev);
 
 	/* Check the DMA addressing support of this device */
-	if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) &&
-	    dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
+	rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+	if (rc) {
 		dev_err(&pdev->dev, "No usable DMA addressing method\n");
-		rc = -EIO;
 		goto err_release_res;
 	}
 
-- 
2.32.0

Re: [PATCH] et131x: Remove useless DMA-32 fallback configuration
Posted by patchwork-bot+netdevbpf@kernel.org 4 years, 5 months ago
Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Sun,  9 Jan 2022 12:13:47 +0100 you wrote:
> As stated in [1], dma_set_mask() with a 64-bit mask never fails if
> dev->dma_mask is non-NULL.
> So, if it fails, the 32 bits case will also fail for the same reason.
> 
> Moreover, dma_set_mask_and_coherent() returns 0 or -EIO, so the return
> code of the function can be used directly. There is no need to 'rc = -EIO'
> explicitly.
> 
> [...]

Here is the summary with links:
  - et131x: Remove useless DMA-32 fallback configuration
    https://git.kernel.org/netdev/net-next/c/948f6b297f6d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html