Skip to contentSkip to conversation

net: dsa: felix: the switch does not support DMA

PATCH Applied Vladimir Oltean 3 participants 3 messages Jan 9, 2021 – Jan 12, 2021

Subsystems (4)
lore
Share & tools
lore

Vladimir Oltean

author maintainer
#0 lore raw

PATCH 1/1 net: dsa: felix: the switch does not support DMA

From: Vladimir Oltean <[email protected]>

The code that sets the DMA mask to 64 bits is bogus, it is taken from the enetc driver together with the rest of the PCI probing boilerplate.

Since this patch is touching the error path to delete err_dma, let's also change the err_alloc_felix label which was incorrect. The kzalloc failure does not need a kfree, but it doesn't hurt either, since kfree works with NULL pointers.

---
 drivers/net/dsa/ocelot/felix_vsc9959.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/net/dsa/ocelot/felix_vsc9959.c +1 -13
index 2e5bbdca5ea4..a87597eef8cf 100644
@@ -1408,17 +1408,6 @@ static int felix_pci_probe(struct pci_dev *pdev,
 		goto err_pci_enable;
 	}
 
-	/* 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;
-		}
-	}
-
 	felix = kzalloc(sizeof(struct felix), GFP_KERNEL);
 	if (!felix) {
 		err = -ENOMEM;
@@ -1474,9 +1463,8 @@ static int felix_pci_probe(struct pci_dev *pdev,
 	kfree(ds);
 err_alloc_ds:
 err_alloc_irq:
-err_alloc_felix:
 	kfree(felix);
-err_dma:
+err_alloc_felix:
 	pci_disable_device(pdev);
 err_pci_enable:
 	return err;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The code that sets the DMA mask to 64 bits is bogus, it is taken from the enetc driver together with the rest of the PCI probing boilerplate.

Since this patch is touching the error path to delete err_dma, let's also change the err_alloc_felix label which was incorrect. The kzalloc failure does not need a kfree, but it doesn't hurt either, since kfree works with NULL pointers.

Signature · 1 line
Florian
maintainer Applied
#2 lore raw
Quoted 6 lines · On Sat, 9 Jan 2021 17:24:39 -0800 Florian Fainelli wrote:
Quoted 5 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The code that sets the DMA mask to 64 bits is bogus, it is taken from the enetc driver together with the rest of the PCI probing boilerplate.

Quoted 8 lines
Quoted 6 lines

Since this patch is touching the error path to delete err_dma, let's also change the err_alloc_felix label which was incorrect. The kzalloc failure does not need a kfree, but it doesn't hurt either, since kfree works with NULL pointers.

Applied, thanks!