1
0
mirror of https://github.com/DigitalDevices/dddvb.git synced 2023-10-10 13:37:43 +02:00

Set allocated memory to zero.

This commit is contained in:
none 2021-03-01 12:57:20 +01:00
parent 01ca1b8805
commit de82a50b4e

View File

@ -281,9 +281,9 @@ static int dma_alloc(struct pci_dev *pdev, struct ddb_dma *dma, int dir)
for (i = 0; i < dma->num; i++) { for (i = 0; i < dma->num; i++) {
if (alt_dma) { if (alt_dma) {
#if (KERNEL_VERSION(4, 13, 0) > LINUX_VERSION_CODE) #if (KERNEL_VERSION(4, 13, 0) > LINUX_VERSION_CODE)
dma->vbuf[i] = kmalloc(dma->size, __GFP_REPEAT); dma->vbuf[i] = kzalloc(dma->size, __GFP_REPEAT);
#else #else
dma->vbuf[i] = kmalloc(dma->size, __GFP_RETRY_MAYFAIL); dma->vbuf[i] = kzalloc(dma->size, __GFP_RETRY_MAYFAIL);
#endif #endif
if (!dma->vbuf[i]) if (!dma->vbuf[i])
return -ENOMEM; return -ENOMEM;
@ -301,7 +301,7 @@ static int dma_alloc(struct pci_dev *pdev, struct ddb_dma *dma, int dir)
dma->vbuf[i] = dma_alloc_coherent(&pdev->dev, dma->vbuf[i] = dma_alloc_coherent(&pdev->dev,
dma->size, dma->size,
&dma->pbuf[i], &dma->pbuf[i],
GFP_KERNEL); GFP_KERNEL | __GFP_ZERO);
if (!dma->vbuf[i]) if (!dma->vbuf[i])
return -ENOMEM; return -ENOMEM;
} }