dmaengine: Use Pointer xt after NULL check.
authorManinder Singh <maninder1.s@samsung.com>
Fri, 26 Jun 2015 10:34:48 +0000 (16:04 +0530)
committerVinod Koul <vinod.koul@intel.com>
Tue, 7 Jul 2015 04:22:11 +0000 (09:52 +0530)
Removing static analysis error:-
Possible null pointer dereference: xt

Because currently xt is dereferenced before NULL check,
Thus Use it after NULL Check.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Vaneet Narang <v.narang@samsung.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/at_hdmac.c

index 59892126d1758f9d0e0821fa88ff62094a0c6e74..d313acbb50e00b4b5bd62fee8802474963cbce4d 100644 (file)
@@ -659,14 +659,14 @@ atc_prep_dma_interleaved(struct dma_chan *chan,
        size_t                  len = 0;
        int                     i;
 
+       if (unlikely(!xt || xt->numf != 1 || !xt->frame_size))
+               return NULL;
+
        dev_info(chan2dev(chan),
                 "%s: src=0x%08x, dest=0x%08x, numf=%d, frame_size=%d, flags=0x%lx\n",
                __func__, xt->src_start, xt->dst_start, xt->numf,
                xt->frame_size, flags);
 
-       if (unlikely(!xt || xt->numf != 1 || !xt->frame_size))
-               return NULL;
-
        /*
         * The controller can only "skip" X bytes every Y bytes, so we
         * need to make sure we are given a template that fit that