[bug report] dmaengine: add CSR SiRFprimaII DMAC driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Rongjun Ying,

The patch ca21a146a45a: "dmaengine: add CSR SiRFprimaII DMAC driver"
from Oct 27, 2011, leads to the following static checker warning:

	drivers/dma/sirf-dma.c:754 sirfsoc_dma_prep_interleaved()
	warn: passing zero to 'ERR_PTR'

drivers/dma/sirf-dma.c
   689  static struct dma_async_tx_descriptor *sirfsoc_dma_prep_interleaved(
   690          struct dma_chan *chan, struct dma_interleaved_template *xt,
   691          unsigned long flags)
   692  {
   693          struct sirfsoc_dma *sdma = dma_chan_to_sirfsoc_dma(chan);
   694          struct sirfsoc_dma_chan *schan = dma_chan_to_sirfsoc_dma_chan(chan);
   695          struct sirfsoc_dma_desc *sdesc = NULL;
   696          unsigned long iflags;
   697          int ret;
   698  
   699          if ((xt->dir != DMA_MEM_TO_DEV) && (xt->dir != DMA_DEV_TO_MEM)) {
   700                  ret = -EINVAL;
                        ^^^^^^^^^^^^^
Here ret is set to an error.

   701                  goto err_dir;
   702          }
   703  
   704          /* Get free descriptor */
   705          spin_lock_irqsave(&schan->lock, iflags);
   706          if (!list_empty(&schan->free)) {
   707                  sdesc = list_first_entry(&schan->free, struct sirfsoc_dma_desc,
   708                          node);
   709                  list_del(&sdesc->node);
   710          }
   711          spin_unlock_irqrestore(&schan->lock, iflags);
   712  
   713          if (!sdesc) {
   714                  /* try to free completed descriptors */
   715                  sirfsoc_dma_process_completed(sdma);
   716                  ret = 0;
                        ^^^^^^^
Here it looks like we're deliberately returning NULL.  Which causes a
static checker warning, but is fine 15% of the time.

   717                  goto no_desc;
   718          }
   719  

	[ snip ]

   748  
   749          return &sdesc->desc;
   750  err_xfer:
   751          spin_unlock_irqrestore(&schan->lock, iflags);
   752  no_desc:
   753  err_dir:
   754          return ERR_PTR(ret);
                       ^^^^^^^^^^^

My question is, it looks like this is called from deinterlace_issue_dma()
and dmaengine_prep_interleaved_dma() but neither expects an error
pointer so the will Oops if we return anything besides NULL.

   755  }

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux