From patchwork Fri Apr 18 02:30:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 28606 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 27A0D2013D for ; Fri, 18 Apr 2014 02:32:23 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rd18sf6416308iec.0 for ; Thu, 17 Apr 2014 19:32:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=HsDyRveouv0homOSZ4xOKZlll9bTCHMbsh3eJgYsQmE=; b=ahWyoF0b6OQcMrDVMszMEwfuZ9GdGHWB40ZvN2I30MtXkshaxH2NFiXuVGGbrDXS3+ dJWby2vbsH6e/36oj2WGdbCG+1r67RYQlltBKP0Y16ETkViLm19yAIUSFUxyyELZ9MlF DBBBB3cqUE2X0Xs9tru6VC30kEMo/yVzSPQWa75qE2FvAa8fUxwrxlPaJ2RtOUjY6MZO QjGXj1aY22aJe4cRNK1bdEO1QTECnqOJ6+CTKhTFzU1yAkSqXsQRqv4SPph3XPQw7+oL zroi8y3tbzpjv8kkPLXruiYxwcruNBoSPfqCSxB0ODi6GODvcn/K4zXau2W5SGhVOUgt DuKQ== X-Gm-Message-State: ALoCoQlkUnU7n7jfb1p68ZvmjQ6PFh4hLrFwObWgijlgg7NNheIkg6AYaeF6R1Eo1yGhOjHcqmCr X-Received: by 10.43.161.202 with SMTP id mh10mr6138646icc.23.1397788343431; Thu, 17 Apr 2014 19:32:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.66 with SMTP id h60ls1275098qge.54.gmail; Thu, 17 Apr 2014 19:32:23 -0700 (PDT) X-Received: by 10.220.106.84 with SMTP id w20mr10650222vco.18.1397788343253; Thu, 17 Apr 2014 19:32:23 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id tm8si4743451vdc.152.2014.04.17.19.32.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Apr 2014 19:32:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id oz11so1803140veb.19 for ; Thu, 17 Apr 2014 19:32:23 -0700 (PDT) X-Received: by 10.52.229.97 with SMTP id sp1mr8935973vdc.23.1397788343170; Thu, 17 Apr 2014 19:32:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp80074vcb; Thu, 17 Apr 2014 19:32:22 -0700 (PDT) X-Received: by 10.140.95.248 with SMTP id i111mr17516896qge.6.1397788342757; Thu, 17 Apr 2014 19:32:22 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id z8si2735280qar.226.2014.04.17.19.32.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Apr 2014 19:32:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WayZr-0004af-9y; Fri, 18 Apr 2014 02:30:55 +0000 Received: from mail-ig0-f169.google.com ([209.85.213.169]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WayZd-0004S2-Dr for linux-arm-kernel@lists.infradead.org; Fri, 18 Apr 2014 02:30:42 +0000 Received: by mail-ig0-f169.google.com with SMTP id h18so586119igc.4 for ; Thu, 17 Apr 2014 19:30:20 -0700 (PDT) X-Received: by 10.50.50.146 with SMTP id c18mr846936igo.42.1397788219955; Thu, 17 Apr 2014 19:30:19 -0700 (PDT) Received: from localhost.localdomain (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPSA id m8sm673967igx.9.2014.04.17.19.30.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Apr 2014 19:30:19 -0700 (PDT) From: Alex Elder To: bcm@fixthebug.org, mporter@linaro.org Subject: [PATCH 02/10] ARM: bcm: err, don't BUG() on SMC init failures Date: Thu, 17 Apr 2014 21:30:07 -0500 Message-Id: <1397788215-20279-3-git-send-email-elder@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1397788215-20279-1-git-send-email-elder@linaro.org> References: <1397788215-20279-1-git-send-email-elder@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140417_193041_628800_684CDC19 X-CRM114-Status: GOOD ( 12.65 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.213.169 listed in list.dnswl.org] Cc: bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: elder@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.174 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Several conditions in bcm_kona_smc_init() are handled with BUG_ON(). That function is capable of returning an error, so do that instead. Also, don't assume of_get_address() returns a valid pointer. Signed-off-by: Alex Elder Reviewed-by: Tim Kryger Reviewed-by: Markus Mayer Reviewed-by: Matt Porter --- arch/arm/mach-bcm/bcm_kona_smc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c index d881c72..ddc2f17 100644 --- a/arch/arm/mach-bcm/bcm_kona_smc.c +++ b/arch/arm/mach-bcm/bcm_kona_smc.c @@ -45,6 +45,7 @@ static const struct of_device_id bcm_kona_smc_ids[] __initconst = { int __init bcm_kona_smc_init(void) { struct device_node *node; + const __be32 *prop_val; /* Read buffer addr and size from the device tree node */ node = of_find_matching_node(NULL, bcm_kona_smc_ids); @@ -52,12 +53,17 @@ int __init bcm_kona_smc_init(void) return -ENODEV; /* Don't care about size or flags of the DT node */ - bridge_data.buffer_addr = - be32_to_cpu(*of_get_address(node, 0, NULL, NULL)); - BUG_ON(!bridge_data.buffer_addr); + prop_val = of_get_address(node, 0, NULL, NULL); + if (!prop_val) + return -EINVAL; + + bridge_data.buffer_addr = be32_to_cpu(*prop_val); + if (!bridge_data.buffer_addr) + return -EINVAL; bridge_data.bounce = of_iomap(node, 0); - BUG_ON(!bridge_data.bounce); + if (!bridge_data.bounce) + return -ENOMEM; bridge_data.initialized = 1;