Replaced dma_zalloc_coherent.

This commit is contained in:
Florian Pose 2020-04-03 12:17:32 +02:00
parent 21d0fb5176
commit 563f6e0cb4
1 changed files with 5 additions and 0 deletions

View File

@ -539,7 +539,12 @@ static int ccat_eth_priv_init_dma(struct ccat_eth_priv *priv)
dma->dev = &pdev->dev;
dma->size = CCAT_ALIGNMENT * 3;
dma->base =
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
/* since kernel 5 memory is zero'd implicitly */
dma_alloc_coherent(dma->dev, dma->size, &dma->phys, GFP_KERNEL);
#else
dma_zalloc_coherent(dma->dev, dma->size, &dma->phys, GFP_KERNEL);
#endif
if (!dma->base || !dma->phys) {
pr_err("init DMA memory failed.\n");
return -ENOMEM;