From patchwork Sat Sep 17 15:25:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9337213 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4144B6077F for ; Sat, 17 Sep 2016 15:26:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 323BE28D18 for ; Sat, 17 Sep 2016 15:26:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 267EC28D1B; Sat, 17 Sep 2016 15:26:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C379B28D18 for ; Sat, 17 Sep 2016 15:26:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752661AbcIQP0h (ORCPT ); Sat, 17 Sep 2016 11:26:37 -0400 Received: from mout.web.de ([212.227.17.12]:64379 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752185AbcIQP0g (ORCPT ); Sat, 17 Sep 2016 11:26:36 -0400 Received: from [192.168.1.2] ([78.48.101.40]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0LiUKG-1b8vwX0Tjo-00cj93; Sat, 17 Sep 2016 17:26:05 +0200 Subject: [PATCH 15/24] ste_dma40: Move two assignments in d40_prep_sg() To: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Dan Williams , Linus Walleij , Vinod Koul References: <566ABCD9.1060404@users.sourceforge.net> <92810066-69b6-94e7-dcec-a28594b1328f@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <820bf972-3613-cf77-d243-9ba480c4c9e0@users.sourceforge.net> Date: Sat, 17 Sep 2016 17:25:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <92810066-69b6-94e7-dcec-a28594b1328f@users.sourceforge.net> X-Provags-ID: V03:K0:iI7nqTftjSQn/DYaWOgLr9fPgkhHpk7HokzMeYRNHl52rvmUIUB P4VXLVLLGatrh9xpKFl8HIpJRt0yFUpSD5j49rPOxYqEZNl5OWjVDKuCBtIu/2O92vKiqFZ pMnpod+ZsEdsBZB6DfkjiARJSNLCTLTNhpPVSqKU6nLAT2Oq4LnCV03tamA9FQOi/szMYMD OVW1HbEbQKfvszBgGZEsA== X-UI-Out-Filterresults: notjunk:1; V01:K0:F0AHXZz77m4=:bgb6p784d4ze+JCTpjt8Ov hwvVp7baVvE3jNuNRgz6TfNjUuIZv6b/Te7cH7XP+xK7MjxOhe58z8GPFNaPj1v1TTLBkiVW4 XmbfYCtRA99gc8ccTSxiFIl//AF9mKi6TniwqMEon2HMSXuNFeOWBbuBPMHL+0lIQDGtUhPmJ Cb5aE0yNnaP6LJQmZfMGg8HO8jdtRD1O4IDMo0Br7ZKwDIEr7m952OW16yqdI+eRtNtmsZN0e a+N9SaBnZrZvs8mn1+yY6iz66UzlTyRpd+OqkTYQ2FnyOtIPdb71lCTDd9dec9HU3WrILgIyF kJEU7fFa+HAIWJIBD4RQWoBa/oNwPSULof7L243V3U7queLd8uRd58jgZEB8Lk//W0hsbmeVV xI/IsnzLRZuIP51JoOILVq8sUn9p6KzzU4P7hzDEjXpnig2wEYCRVXW6NL2DHLfP8S4esqcS5 hELVKlQjtSYtMF9gfaDXsF9XysDH5AR80IbiHqy9KjtTAMq6gcfEIKGgd5KxQGhMISvH5VXuN oqjOt7sRDLI6uDcydrZPp0awjedfN7vg5HnBPZdvt+yVJ4sHSBamsIyKFUa5EgwdOKDncpnqg n6EBSbSR830W70pOu5xbc587WF9zlDXOvIxsnVMZ7OZXeJKCzJrEc1SWcR/NjFphON+WyYkpy BWruAKT5ja5Y4THS1vbQZlqAEW5SGWqUpPjKluKo2x3sm5tPbML3c8LtQk/vQg04tohLQ8Mvd Fds1g3fKHH/dYoyLI0wnJQD6jt9H54zKQgyyTcr0VIHqr4fzDlX6yMDIyIl/ggQ+vbUOLcxFv 5ry4/cL Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 17 Sep 2016 15:40:05 +0200 Move assignments for two local variables so that their setting will only be performed after corresponding data processing succeeded by this function. Signed-off-by: Markus Elfring --- drivers/dma/ste_dma40.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index a7e7cd0..6725b66 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -2236,8 +2236,8 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src, enum dma_transfer_direction direction, unsigned long dma_flags) { struct d40_chan *chan = container_of(dchan, struct d40_chan, chan); - dma_addr_t src_dev_addr = 0; - dma_addr_t dst_dev_addr = 0; + dma_addr_t src_dev_addr; + dma_addr_t dst_dev_addr; struct d40_desc *desc; unsigned long flags; int ret; @@ -2256,6 +2256,8 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src, if (sg_next(&sg_src[sg_len - 1]) == sg_src) desc->cyclic = true; + src_dev_addr = 0; + dst_dev_addr = 0; if (direction == DMA_DEV_TO_MEM) src_dev_addr = chan->runtime_addr; else if (direction == DMA_MEM_TO_DEV)