re: dmaengine: rcar-dmac: Add Renesas R-Car Gen2 DMA Controller (DMAC) driver

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

 



Hello Laurent Pinchart,

The patch 87244fe5abdf: "dmaengine: rcar-dmac: Add Renesas R-Car Gen2
DMA Controller (DMAC) driver" from Jul 9, 2014, leads to the
following static checker warning:

	drivers/dma/sh/rcar-dmac.c:571 rcar_dmac_desc_get()
	error: potentially using uninitialized 'desc'.

drivers/dma/sh/rcar-dmac.c
   542  static struct rcar_dmac_desc *rcar_dmac_desc_get(struct rcar_dmac_chan *chan)
   543  {
   544          struct rcar_dmac_desc *desc;
                                       ^^^^
Not initialized.

   545          int ret;
   546  
   547          /* Recycle acked descriptors before attempting allocation. */
   548          rcar_dmac_desc_recycle_acked(chan);
   549  
   550          spin_lock_irq(&chan->lock);
   551  
   552          do {
   553                  if (list_empty(&chan->desc.free)) {
   554                          /*
   555                           * No free descriptors, allocate a page worth of them
   556                           * and try again, as someone else could race us to get
   557                           * the newly allocated descriptors. If the allocation
   558                           * fails return an error.
   559                           */
   560                          spin_unlock_irq(&chan->lock);
   561                          ret = rcar_dmac_desc_alloc(chan, GFP_NOWAIT);
   562                          if (ret < 0)
   563                                  return NULL;
   564                          spin_lock_irq(&chan->lock);
   565                          continue;
                                ^^^^^^^^
Let's assume that the list is empty on the first iteration through the
loop so we hit this continue.

   566                  }
   567  
   568                  desc = list_first_entry(&chan->desc.free, struct rcar_dmac_desc,
   569                                          node);
   570                  list_del(&desc->node);
   571          } while (!desc);
                          ^^^^
Then we don't know if 'desc' is NULL or not because it wasn't
initialized.

   572  
   573          spin_unlock_irq(&chan->lock);
   574  
   575          return desc;
   576  }

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