From patchwork Fri May 3 14:32:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 16653 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f199.google.com (mail-gh0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5755423905 for ; Fri, 3 May 2013 14:34:21 +0000 (UTC) Received: by mail-gh0-f199.google.com with SMTP id g14sf2522344ghb.6 for ; Fri, 03 May 2013 07:34:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=UiKGJ8gFGHqQXxUnUyLt4/UktD2W3V3aA5pFi+yXB9w=; b=JhTHOTqxkpBv8IpnBsWf49Ilw+nDh6mw8x3PSMrexrrWH2WZjFxns++qzzXQphB3Cy 076SeCCUNkfgp1P+S4xc2OY5ILhPiFgeEIUzC36rrVySKkGW1SZdKadObv+RExqa2gdn TdmWnAgCFNTMsTavf7JGeD7pYOpd1Qp2z/q0ioEtQ7KocWUdDL8kHVzgcIQHAukFk19m mqjOIWRM6TF0JitUq269Txmz70PwfVMPsZO9k/THmE1KtyPqvS+Qi9sQVPI+vxo8k1dK ktKVB9KyYcG999DtUgf/rL2gM5lhhIcXV1c3b1JK0cRZh0pbHLwVHvyyJ+cYV7g+kMyu 7bmQ== X-Received: by 10.236.15.164 with SMTP id f24mr8693185yhf.50.1367591651497; Fri, 03 May 2013 07:34:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.51.69 with SMTP id i5ls1711490qeo.89.gmail; Fri, 03 May 2013 07:34:11 -0700 (PDT) X-Received: by 10.58.203.166 with SMTP id kr6mr3644438vec.53.1367591651278; Fri, 03 May 2013 07:34:11 -0700 (PDT) Received: from mail-ve0-x236.google.com (mail-ve0-x236.google.com [2607:f8b0:400c:c01::236]) by mx.google.com with ESMTPS id ir6si5153929vdb.117.2013.05.03.07.34.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 07:34:11 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::236; Received: by mail-ve0-f182.google.com with SMTP id jx10so1556523veb.13 for ; Fri, 03 May 2013 07:34:11 -0700 (PDT) X-Received: by 10.52.71.4 with SMTP id q4mr3192565vdu.8.1367591651174; Fri, 03 May 2013 07:34:11 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp25193veb; Fri, 3 May 2013 07:34:10 -0700 (PDT) X-Received: by 10.194.108.165 with SMTP id hl5mr14257887wjb.22.1367591650175; Fri, 03 May 2013 07:34:10 -0700 (PDT) Received: from mail-we0-x234.google.com (mail-we0-x234.google.com [2a00:1450:400c:c03::234]) by mx.google.com with ESMTPS id l6si3597023wja.193.2013.05.03.07.34.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 07:34:10 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::234 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::234; Received: by mail-we0-f180.google.com with SMTP id x43so1319381wey.25 for ; Fri, 03 May 2013 07:34:09 -0700 (PDT) X-Received: by 10.180.187.206 with SMTP id fu14mr13704363wic.11.1367591649761; Fri, 03 May 2013 07:34:09 -0700 (PDT) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPSA id o3sm17516019wia.2.2013.05.03.07.34.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 May 2013 07:34:08 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, srinidhi.kasagar@stericsson.com, Lee Jones Subject: [PATCH 22/63] dmaengine: ste_dma40: Move rev error-check up to revision acquisition Date: Fri, 3 May 2013 15:32:08 +0100 Message-Id: <1367591569-32197-23-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1367591569-32197-1-git-send-email-lee.jones@linaro.org> References: <1367591569-32197-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQlRtMUohe3q832lC6i7FtPRaAIhH5gPaT0WMlkoG8SL2SCbv27w0cWITxVeN7fHFIIIs4TK X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , At the moment we fetch the hardware revision, then do some stuff, then check whether the revision is correct and return in error if it's not. Well we may as well check it as soon as we know what it is, so let's move the check right up underneath where we acquire the version. Acked-by: Vinod Koul Reviewed-by: Linus Walleij Signed-off-by: Lee Jones --- drivers/dma/ste_dma40.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 34e0fb0..e5f0e3c 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -3198,6 +3198,10 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) * DB8540v1 has revision 4 */ rev = AMBA_REV_BITS(pid); + if (rev < 2) { + d40_err(&pdev->dev, "hardware revision: %d is not supported", rev); + goto failure; + } plat_data = pdev->dev.platform_data; @@ -3212,12 +3216,6 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) dev_info(&pdev->dev, "hardware revision: %d @ 0x%x with %d physical channels\n", rev, res->start, num_phy_chans); - if (rev < 2) { - d40_err(&pdev->dev, "hardware revision: %d is not supported", - rev); - goto failure; - } - base = kzalloc(ALIGN(sizeof(struct d40_base), 4) + (num_phy_chans + num_log_chans + ARRAY_SIZE(dma40_memcpy_channels)) * sizeof(struct d40_chan), GFP_KERNEL);