netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fec: check DMA addressing limitations
@ 2018-08-01 11:44 Stefan Agner
  2018-08-02  2:00 ` Andy Duan
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Agner @ 2018-08-01 11:44 UTC (permalink / raw)
  To: fugang.duan, davem; +Cc: krzk, robin.murphy, netdev, linux-kernel, Stefan Agner

Check DMA addressing limitations as suggested by the DMA API
how-to. This does not fix a particular issue seen but is
considered good style.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/net/ethernet/freescale/fec_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index c729665107f5..af0fb200e936 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3146,6 +3146,12 @@ static int fec_enet_init(struct net_device *ndev)
 	fep->tx_align = 0x3;
 #endif
 
+	/* Check mask of the streaming and coherent API */
+	if (dma_set_mask_and_coherent(&fep->pdev->dev, DMA_BIT_MASK(32))) {
+		dev_warn(&fep->pdev->dev, "No suitable DMA available\n");
+		return -ENODEV;
+	}
+
 	fec_enet_alloc_queue(ndev);
 
 	bd_size = (fep->total_tx_ring_size + fep->total_rx_ring_size) * dsize;
-- 
2.18.0

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

end of thread, other threads:[~2018-08-02  8:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-01 11:44 [PATCH] net: fec: check DMA addressing limitations Stefan Agner
2018-08-02  2:00 ` Andy Duan
2018-08-02  7:15   ` Stefan Agner
2018-08-02  7:47     ` Andy Duan
2018-08-02  8:35       ` Stefan Agner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).