--- zzzz-none-000/linux-3.10.107/drivers/media/pci/ngene/ngene-core.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/media/pci/ngene/ngene-core.c 2021-02-04 17:41:59.000000000 +0000 @@ -57,15 +57,13 @@ #define dprintk if (debug) printk -#define ngwriteb(dat, adr) writeb((dat), (char *)(dev->iomem + (adr))) -#define ngwritel(dat, adr) writel((dat), (char *)(dev->iomem + (adr))) -#define ngwriteb(dat, adr) writeb((dat), (char *)(dev->iomem + (adr))) +#define ngwriteb(dat, adr) writeb((dat), dev->iomem + (adr)) +#define ngwritel(dat, adr) writel((dat), dev->iomem + (adr)) +#define ngwriteb(dat, adr) writeb((dat), dev->iomem + (adr)) #define ngreadl(adr) readl(dev->iomem + (adr)) #define ngreadb(adr) readb(dev->iomem + (adr)) -#define ngcpyto(adr, src, count) memcpy_toio((char *) \ - (dev->iomem + (adr)), (src), (count)) -#define ngcpyfrom(dst, adr, count) memcpy_fromio((dst), (char *) \ - (dev->iomem + (adr)), (count)) +#define ngcpyto(adr, src, count) memcpy_toio(dev->iomem + (adr), (src), (count)) +#define ngcpyfrom(dst, adr, count) memcpy_fromio((dst), dev->iomem + (adr), (count)) /****************************************************************************/ /* nGene interrupt handler **************************************************/ @@ -910,7 +908,6 @@ { dma_addr_t tmp; u32 i, j; - int status = 0; u32 SCListMemSize = pRingBuffer->NumBuffers * ((Buffer2Length != 0) ? (NUM_SCATTER_GATHER_ENTRIES * 2) : NUM_SCATTER_GATHER_ENTRIES) @@ -1010,14 +1007,12 @@ } - return status; + return 0; } static int FillTSIdleBuffer(struct SRingBufferDescriptor *pIdleBuffer, struct SRingBufferDescriptor *pRingBuffer) { - int status = 0; - /* Copy pointer to scatter gather list in TSRingbuffer structure for buffer 2 Load number of buffer @@ -1038,7 +1033,7 @@ pIdleBuffer->Head->ngeneBuffer.Number_of_entries_1; Cur = Cur->Next; } - return status; + return 0; } static u32 RingBufferSizes[MAX_STREAM] = { @@ -1078,12 +1073,11 @@ dev->ngenetohost = dev->FWInterfaceBuffer + 256; dev->EventBuffer = dev->FWInterfaceBuffer + 512; - dev->OverflowBuffer = pci_alloc_consistent(dev->pci_dev, - OVERFLOW_BUFFER_SIZE, - &dev->PAOverflowBuffer); + dev->OverflowBuffer = pci_zalloc_consistent(dev->pci_dev, + OVERFLOW_BUFFER_SIZE, + &dev->PAOverflowBuffer); if (!dev->OverflowBuffer) return -ENOMEM; - memset(dev->OverflowBuffer, 0, OVERFLOW_BUFFER_SIZE); for (i = STREAM_VIDEOIN1; i < MAX_STREAM; i++) { int type = dev->card_info->io_type[i]; @@ -1532,10 +1526,12 @@ if (chan->fe2) { if (dvb_register_frontend(adapter, chan->fe2) < 0) goto err; - chan->fe2->tuner_priv = chan->fe->tuner_priv; - memcpy(&chan->fe2->ops.tuner_ops, - &chan->fe->ops.tuner_ops, - sizeof(struct dvb_tuner_ops)); + if (chan->fe) { + chan->fe2->tuner_priv = chan->fe->tuner_priv; + memcpy(&chan->fe2->ops.tuner_ops, + &chan->fe->ops.tuner_ops, + sizeof(struct dvb_tuner_ops)); + } } if (chan->has_demux) { @@ -1596,7 +1592,7 @@ dvb_ca_en50221_release(ci->en); kfree(ci->en); - ci->en = 0; + ci->en = NULL; } /***********************************/ @@ -1622,7 +1618,7 @@ void ngene_shutdown(struct pci_dev *pdev) { - struct ngene *dev = (struct ngene *)pci_get_drvdata(pdev); + struct ngene *dev = pci_get_drvdata(pdev); if (!dev || !shutdown_workaround) return; @@ -1648,7 +1644,6 @@ cxd_detach(dev); ngene_stop(dev); ngene_release_buffers(dev); - pci_set_drvdata(pdev, NULL); pci_disable_device(pdev); } @@ -1702,6 +1697,5 @@ ngene_release_buffers(dev); fail0: pci_disable_device(pci_dev); - pci_set_drvdata(pci_dev, NULL); return stat; }