From 86145910697891c6adb8fc11c48d59cf1ec4a842 Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sat, 17 Sep 2016 15:54:12 +0200 Subject: [PATCH] ste_dma40: Move an assignment in d40_prep_desc() Move one assignment for the local variable "cfg" so that its setting will only be performed after a call of the function "d40_desc_get" succeeded by this function. Signed-off-by: Markus Elfring Reviewed-by: Linus Walleij Signed-off-by: Vinod Koul --- drivers/dma/ste_dma40.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 087861a..07e7eb3 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -2198,7 +2198,7 @@ static struct d40_desc * d40_prep_desc(struct d40_chan *chan, struct scatterlist *sg, unsigned int sg_len, unsigned long dma_flags) { - struct stedma40_chan_cfg *cfg = &chan->dma_cfg; + struct stedma40_chan_cfg *cfg; struct d40_desc *desc; int ret; @@ -2206,6 +2206,7 @@ d40_prep_desc(struct d40_chan *chan, struct scatterlist *sg, if (!desc) return NULL; + cfg = &chan->dma_cfg; desc->lli_len = d40_sg_2_dmalen(sg, sg_len, cfg->src_info.data_width, cfg->dst_info.data_width); if (desc->lli_len < 0) { -- 2.7.4