diff --git a/ddbridge/ddbridge-core.c b/ddbridge/ddbridge-core.c index 40f7cbc..aeb6c08 100644 --- a/ddbridge/ddbridge-core.c +++ b/ddbridge/ddbridge-core.c @@ -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++) { if (alt_dma) { #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 - dma->vbuf[i] = kmalloc(dma->size, __GFP_RETRY_MAYFAIL); + dma->vbuf[i] = kzalloc(dma->size, __GFP_RETRY_MAYFAIL); #endif if (!dma->vbuf[i]) return -ENOMEM; @@ -301,10 +301,12 @@ static int dma_alloc(struct pci_dev *pdev, struct ddb_dma *dma, int dir) dma->vbuf[i] = dma_alloc_coherent(&pdev->dev, dma->size, &dma->pbuf[i], - GFP_KERNEL); + GFP_KERNEL | __GFP_ZERO); if (!dma->vbuf[i]) return -ENOMEM; } + if (((u64)dma->vbuf[i] & 0xfff)) + dev_err(&pdev->dev, "DMA memory at %px not aligned!\n", dma->vbuf[i]); } return 0; } @@ -2305,7 +2307,7 @@ static void input_write_dvb(struct ddb_input *input, dma2->vbuf[dma->cbuf], dma2->size); } else { - if (dma2->vbuf[dma->cbuf][0] != 0x47) { + if (dma2->unaligned || (dma2->vbuf[dma->cbuf][0] != 0x47)) { if (!dma2->unaligned) { dma2->unaligned++; dev_warn(dev->dev, "Input %u dma buffer unaligned, " @@ -2313,7 +2315,7 @@ static void input_write_dvb(struct ddb_input *input, input->nr); print_hex_dump(KERN_INFO, "TS: ", DUMP_PREFIX_OFFSET, 32, 1, dma2->vbuf[dma->cbuf], - 256, false); + 512, false); } dvb_dmx_swfilter(&dvb->demux, dma2->vbuf[dma->cbuf],