From patchwork Wed Aug 28 14:47:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19591 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A178025E58 for ; Wed, 28 Aug 2013 14:48:58 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id ii20sf851553qab.9 for ; Wed, 28 Aug 2013 07:48:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=qLJ/ROCGCOAF/QwHWbLVuONszACT0FWsgHXt7W+y7FY=; b=Hqm8G1d46wIKyOgkXe6SNND5A1xbUpvotg03WIJnzHw1hjd+YQ8ySMF20NfI95Rie1 Xj9+SZXDsHvW2w8dUDqKzgEZznrRstIrAhDjmu2Wonscq+pRKmHWKvv0enSRkGLvkPca cdZ6Ql5WKOFQJNvhEyUYl1wFa1EPxtAX4udAa5i4OWR0Uz8cMOTJIfugCihLtqMvEw4n XZYJo46bCeK4s9lsVRG3hQYZLjmQkAo28yNM/0PntOCsQZWFyZh0LKuTejcsDEAOpb+i jnNVgqLumOsTOaNkvjs8uiA5+hthcXB+fHW3Tf7JsWJhpT9pdiH39+anBpcljXT8/AYC d0Rg== X-Received: by 10.236.166.35 with SMTP id f23mr10224702yhl.22.1377701338469; Wed, 28 Aug 2013 07:48:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.94.165 with SMTP id dd5ls363589qeb.87.gmail; Wed, 28 Aug 2013 07:48:58 -0700 (PDT) X-Received: by 10.220.88.13 with SMTP id y13mr14285355vcl.20.1377701338365; Wed, 28 Aug 2013 07:48:58 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id mq14si6594377vcb.131.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 07:48:58 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.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.220.174; Received: by mail-vc0-f174.google.com with SMTP id gd11so4050375vcb.5 for ; Wed, 28 Aug 2013 07:48:58 -0700 (PDT) X-Gm-Message-State: ALoCoQksUgENXIKH1f46j6bJB2XfnejS35staeDI0NTJ4rV/2LiLymNw/GTYES5WOMrCcwDcub7k X-Received: by 10.52.98.7 with SMTP id ee7mr538186vdb.37.1377701338290; Wed, 28 Aug 2013 07:48:58 -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.220.174.196 with SMTP id u4csp359992vcz; Wed, 28 Aug 2013 07:48:57 -0700 (PDT) X-Received: by 10.194.94.137 with SMTP id dc9mr8909129wjb.38.1377701330217; Wed, 28 Aug 2013 07:48:50 -0700 (PDT) Received: from mail-we0-f180.google.com (mail-we0-f180.google.com [74.125.82.180]) by mx.google.com with ESMTPS id a16si310522wiv.72.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 07:48:50 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.180 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.180; Received: by mail-we0-f180.google.com with SMTP id q58so5359859wes.11 for ; Wed, 28 Aug 2013 07:48:49 -0700 (PDT) X-Received: by 10.194.176.163 with SMTP id cj3mr20477023wjc.8.1377701329483; Wed, 28 Aug 2013 07:48:49 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id a8sm5590498wie.6.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 Aug 2013 07:48:48 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, andre.przywara@linaro.org, Julien Grall Subject: [PATCH V1 28/29] xen/arm: Check if the device is available before using it Date: Wed, 28 Aug 2013 15:47:42 +0100 Message-Id: <1377701263-3319-29-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1377701263-3319-1-git-send-email-julien.grall@linaro.org> References: <1377701263-3319-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.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 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: , It's possible to have a device description in the DTS but the device is not wired. device_init must check if the device is available before doing anything with it. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- xen/arch/arm/device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c index dc751a9..f86b2e3 100644 --- a/xen/arch/arm/device.c +++ b/xen/arch/arm/device.c @@ -47,6 +47,9 @@ int __init device_init(struct dt_device_node *dev, enum device_type type, ASSERT(dev != NULL); + if ( !dt_device_is_available(dev) ) + return -ENODEV; + for ( desc = _sdevice; desc != _edevice; desc++ ) { if ( desc->type != type )