From patchwork Fri May 31 01:50:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2639601 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 6AB8BDF2A1 for ; Fri, 31 May 2013 01:50:42 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UiEUG-0006yz-Uj; Fri, 31 May 2013 01:50:37 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UiEUE-000558-6Y; Fri, 31 May 2013 01:50:34 +0000 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UiEU9-00054S-7I for linux-arm-kernel@lists.infradead.org; Fri, 31 May 2013 01:50:31 +0000 Received: by mail-wi0-f176.google.com with SMTP id hr14so251162wib.3 for ; Thu, 30 May 2013 18:50:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=R1pNMzELzT22Oj1jTLKJdMZ5Ku5G3FQcWB3Ey7R4PLg=; b=IFWBge10Wekg5Z7ARSO6+aE9EMvh15oSJ2lGnGkz0r4qy2t1Rigr21hVFrfKEIViqk fzKVLgPeQAr1IFOMLb3JVj6ZHpKPeRMtc8B3WFbu/E/2uSPvd59LgNyr/eRdK1XXcBoH /J8ryWotFuHIynDLtZTst5DA+iBLCtLbLG6Q2Zt6RXyyEKXbn9YvNBZ33DWfD/4XMA6R mQwhhAyH0yqws7h8xXekTfN+KrIeFXtI5+dfeoc1KsGqCw2vhxW5xeDUWicwTNUifDuC +e1Cs4wohGY8fAguBJksLo0zPrcYGdZEf15yzcimTBig2ePjb8yj+rFX88PPx+fDNyHn g0CA== MIME-Version: 1.0 X-Received: by 10.194.5.162 with SMTP id t2mr7247417wjt.14.1369965007546; Thu, 30 May 2013 18:50:07 -0700 (PDT) Received: by 10.194.103.38 with HTTP; Thu, 30 May 2013 18:50:07 -0700 (PDT) Date: Fri, 31 May 2013 09:50:07 +0800 Message-ID: Subject: [PATCH -next v3] dmaengine: ste_dma40: fix error return code in d40_probe() From: Wei Yongjun To: srinidhi.kasagar@stericsson.com, linus.walleij@linaro.org, djbw@fb.com, vinod.koul@intel.com, grant.likely@linaro.org, rob.herring@calxeda.com, andy.shevchenko@gmail.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130530_215029_407755_D268A7BF X-CRM114-Status: GOOD ( 10.64 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (weiyj.lk[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: yongjun_wei@trendmicro.com.cn, devicetree-discuss@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Wei Yongjun In many of the error handling case, the return value 'ret' not set and 0 will be return from d40_probe() even if error, but we should return a negative error code instead in those error handling case. This patch fixed them, and also removed useless variable 'err'. Signed-off-by: Wei Yongjun --- v2 -> v3: move NULL assign below set ret, and remove redundant ENODEV check. --- drivers/dma/ste_dma40.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 7f23d45..88e3cd4 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -3506,7 +3506,6 @@ static int __init d40_probe(struct platform_device *pdev) { struct stedma40_platform_data *plat_data = pdev->dev.platform_data; struct device_node *np = pdev->dev.of_node; - int err; int ret = -ENOENT; struct d40_base *base = NULL; struct resource *res = NULL; @@ -3618,6 +3617,7 @@ static int __init d40_probe(struct platform_device *pdev) base->lcpa_regulator = regulator_get(base->dev, "lcla_esram"); if (IS_ERR(base->lcpa_regulator)) { d40_err(&pdev->dev, "Failed to get lcpa_regulator\n"); + ret = PTR_ERR(base->lcpa_regulator); base->lcpa_regulator = NULL; goto failure; } @@ -3633,13 +3633,13 @@ static int __init d40_probe(struct platform_device *pdev) } base->initialized = true; - err = d40_dmaengine_init(base, num_reserved_chans); - if (err) + ret = d40_dmaengine_init(base, num_reserved_chans); + if (ret) goto failure; base->dev->dma_parms = &base->dma_parms; - err = dma_set_max_seg_size(base->dev, STEDMA40_MAX_SEG_SIZE); - if (err) { + ret = dma_set_max_seg_size(base->dev, STEDMA40_MAX_SEG_SIZE); + if (ret) { d40_err(&pdev->dev, "Failed to set dma max seg size\n"); goto failure; } @@ -3647,8 +3647,8 @@ static int __init d40_probe(struct platform_device *pdev) d40_hw_init(base); if (np) { - err = of_dma_controller_register(np, d40_xlate, NULL); - if (err && err != -ENODEV) + ret = of_dma_controller_register(np, d40_xlate, NULL); + if (ret) dev_err(&pdev->dev, "could not register of_dma_controller\n"); }