From patchwork Thu May 30 04:32:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2633641 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id D15863FD2B for ; Thu, 30 May 2013 04:33:43 +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 1UhuYJ-0005MU-6g; Thu, 30 May 2013 04:33:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UhuY7-0005qc-S8; Thu, 30 May 2013 04:33:15 +0000 Received: from mail-bk0-x236.google.com ([2a00:1450:4008:c01::236]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UhuY3-0005pj-6v for linux-arm-kernel@lists.infradead.org; Thu, 30 May 2013 04:33:13 +0000 Received: by mail-bk0-f54.google.com with SMTP id it16so4948658bkc.13 for ; Wed, 29 May 2013 21:32:46 -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=o2JGNVd6ysgnJW+kKUDuNbYvAyzbVgzlprxljtKmR0s=; b=XUjGDknYTCIwcMkgQS3WOLYYE9iQgA4TewVyhzjwonDFGHEOmJRP97dWY/YSzz4A/m g40hIMLOQodA9muIqhPok+i6ORM68OQwM/YzDMlqPIDyDAXo6YHer2mABYOUSaoYGLtt AO9QW8prcCYWxca3AO8tegJFULJqoOBSznb6zYFr7+/8vNXnAD3RKIgexqNDrrAcYR8N 8VNqwXdbtDn3yYUm1gktQ00K1MimKU4Ci0MHe3tdGgbCirRgXOIbsZtGaEv/pfc7Egui Kvh67D1h6LS742TyR+lEMnjrDCe86hx0NDADCp3OXOLeqdmzJEc+1DrRqm8WcSaTqnmD Bi9A== MIME-Version: 1.0 X-Received: by 10.205.55.17 with SMTP id vw17mr1175451bkb.24.1369888365956; Wed, 29 May 2013 21:32:45 -0700 (PDT) Received: by 10.204.39.1 with HTTP; Wed, 29 May 2013 21:32:45 -0700 (PDT) Date: Thu, 30 May 2013 12:32:45 +0800 Message-ID: Subject: [PATCH -next v2] dmaengine: ste_dma40: fix error return code in d40_probe() From: Wei Yongjun To: srinidhi.kasagar@stericsson.com, linus.walleij@linaro.org, vinod.koul@intel.com, djbw@fb.com, grant.likely@linaro.org, rob.herring@calxeda.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130530_003311_403373_E3A5B57F X-CRM114-Status: GOOD ( 11.40 ) 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 Acked-by: Linus Walleij --- v1 -> v2: rebased on linux-next.git --- 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..a241e25 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; @@ -3619,6 +3618,7 @@ static int __init d40_probe(struct platform_device *pdev) if (IS_ERR(base->lcpa_regulator)) { d40_err(&pdev->dev, "Failed to get lcpa_regulator\n"); base->lcpa_regulator = NULL; + ret = PTR_ERR(base->lcpa_regulator); 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 && ret != -ENODEV) dev_err(&pdev->dev, "could not register of_dma_controller\n"); }