From patchwork Thu Jun 9 03:58:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 1781 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.45.109) by localhost6.localdomain6 with IMAP4-SSL; 10 Jun 2011 20:11:39 -0000 Delivered-To: patches@linaro.org Received: by 10.52.181.10 with SMTP id ds10cs218109vdc; Wed, 8 Jun 2011 20:58:39 -0700 (PDT) Received: by 10.229.131.32 with SMTP id v32mr157027qcs.35.1307591919289; Wed, 08 Jun 2011 20:58:39 -0700 (PDT) Received: from mail-qy0-f171.google.com (mail-qy0-f171.google.com [209.85.216.171]) by mx.google.com with ESMTPS id mz9si2189167qcb.169.2011.06.08.20.58.38 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Jun 2011 20:58:38 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.216.171 is neither permitted nor denied by best guess record for domain of nicolas.pitre@linaro.org) client-ip=209.85.216.171; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.216.171 is neither permitted nor denied by best guess record for domain of nicolas.pitre@linaro.org) smtp.mail=nicolas.pitre@linaro.org Received: by qyj19 with SMTP id 19so2669376qyj.16 for ; Wed, 08 Jun 2011 20:58:38 -0700 (PDT) Received: by 10.229.62.209 with SMTP id y17mr126551qch.196.1307591918009; Wed, 08 Jun 2011 20:58:38 -0700 (PDT) Received: from xanadu.home (modemcable092.28-130-66.mc.videotron.ca [66.130.28.92]) by mx.google.com with ESMTPS id r32sm958391qcs.26.2011.06.08.20.58.36 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Jun 2011 20:58:37 -0700 (PDT) Date: Wed, 8 Jun 2011 23:58:36 -0400 (EDT) From: Nicolas Pitre X-X-Sender: nico@xanadu.home To: patches@arm.linux.org.uk cc: patches@linaro.org Subject: ARM: DT: don't try to access physical address zero Message-ID: User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 If the DT physical address is zero, this is equivalent to no DT. Especially when the actual RAM physical address is not located at zero, the result of phys_to_virt() would point to la-la-land and crash the kernel, which crash is completely silent this early during boot. Signed-off-by: Nicolas Pitre Acked-by: Grant Likely PATCH FOLLOWS KernelVersion: v3.0-rc1 diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index a701e42..0cdd7b4 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -76,6 +76,9 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) unsigned long dt_root; const char *model; + if (!dt_phys) + return NULL; + devtree = phys_to_virt(dt_phys); /* check device tree validity */