From patchwork Thu Nov 15 18:09:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moseley, Drew" X-Patchwork-Id: 1751311 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 45824DF2AB for ; Thu, 15 Nov 2012 18:11:40 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TZ3sl-0008AB-Sv; Thu, 15 Nov 2012 18:09:44 +0000 Received: from relay1.mentorg.com ([192.94.38.131]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TZ3sf-00086p-MQ for linux-arm-kernel@lists.infradead.org; Thu, 15 Nov 2012 18:09:38 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1TZ3sa-0004BH-9A from drew_moseley@mentor.com ; Thu, 15 Nov 2012 10:09:32 -0800 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 15 Nov 2012 10:09:32 -0800 Received: from NA-MBX-02.mgc.mentorg.com ([169.254.2.123]) by SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) with mapi id 14.01.0289.001; Thu, 15 Nov 2012 10:09:14 -0800 From: "Moseley, Drew" To: Shawn Guo Subject: Re: [PATCH 01/10] ARM: imx6q: print silicon version on boot Thread-Topic: [PATCH 01/10] ARM: imx6q: print silicon version on boot Thread-Index: AQHNw1xbkXe7V3HEpkytgVG85DtY7g== Date: Thu, 15 Nov 2012 18:09:31 +0000 Message-ID: <72B629D8-8CD8-42E2-91A3-CF0532B15E5F@mentor.com> References: <1351005779-30347-1-git-send-email-shawn.guo@linaro.org> <1351005779-30347-2-git-send-email-shawn.guo@linaro.org> In-Reply-To: <1351005779-30347-2-git-send-email-shawn.guo@linaro.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [147.34.91.1] Content-ID: <6855123D08AFF547AA584E9CFDA459C5@mentor.com> MIME-Version: 1.0 X-OriginalArrivalTime: 15 Nov 2012 18:09:32.0142 (UTC) FILETIME=[5C9700E0:01CDC35C] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121115_130937_914134_62F6C2F8 X-CRM114-Status: GOOD ( 12.28 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Oct 23, 2012, at 11:22 AM, Shawn Guo wrote: > i.MX6Q has 3 revisions 1.0, 1.1 and 1.2. Print revision on boot. > > Signed-off-by: Shawn Guo > --- > arch/arm/mach-imx/mach-imx6q.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > Hi Shawn, An addition to this patch to add some error checking. Thoughts? Drew Add error checking to imx6q_revision() Signed-off-by: Drew Moseley --- arch/arm/mach-imx/mach-imx6q.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 265c311..072e32a 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -54,9 +54,16 @@ static int imx6q_revision(void) if (!rev) { np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop"); + if (!np) + return IMX_CHIP_REVISION_UNKNOWN; base = of_iomap(np, 0); + if (!base) { + of_node_put(np); + return IMX_CHIP_REVISION_UNKNOWN; + } rev = readl_relaxed(base + IMX6Q_ANALOG_DIGPROG); iounmap(base); + of_node_put(np); } switch (rev & 0xff) {