From patchwork Tue Sep 10 14:49:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19928 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CBD25246A4 for ; Tue, 10 Sep 2013 14:50:00 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id oy12sf8075813veb.7 for ; Tue, 10 Sep 2013 07:50:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; 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=lfWSb8tfF1Rj9K3eNN1S5zKpDbBc7oxhhqca6oIC7WhfJ5Nk9FgbNZhX7IW0+MTQhK 8uRpWwo4gAroEvThf69XthJrcXxVfnrgHgvPnq9FywTg2XXVVZnyEDjqQ9Ci1ZowBebL +hQm2V/mrLzvLl5GXex7GbMGyx94ggOHKR04qjEI67+QVSELCWmLxZ3tEP5MPP132Uah MxVQhClTvc51ZIlcoTLBSVUSaSQXMqVZVvJAbhS5XYvbUi+P6SQIL7fPSDQwBOAKdWQL 4NBTiGfSt9/Lc6DQkanFKzMobjHd18hi0lwobXQegwISNC4+ikdjlJ1ib30/gRqE3LvW tRCw== X-Received: by 10.236.6.134 with SMTP id 6mr8908899yhn.7.1378824600668; Tue, 10 Sep 2013 07:50:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.196 with SMTP id w4ls2057770qen.71.gmail; Tue, 10 Sep 2013 07:50:00 -0700 (PDT) X-Received: by 10.58.152.3 with SMTP id uu3mr23360548veb.16.1378824600429; Tue, 10 Sep 2013 07:50:00 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id wp10si4508991vdb.136.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:50:00 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.175 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.175; Received: by mail-ve0-f175.google.com with SMTP id jy13so4537450veb.20 for ; Tue, 10 Sep 2013 07:50:00 -0700 (PDT) X-Gm-Message-State: ALoCoQkOaYqoj+3S5RAKXwKKPYyZqk+Ze9+ZonkWEXfRAmio+OkvehgoRjOXWlTWstsgyWfKXxbf X-Received: by 10.221.6.195 with SMTP id ol3mr313856vcb.34.1378824600351; Tue, 10 Sep 2013 07:50:00 -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 u4csp4682vcz; Tue, 10 Sep 2013 07:49:59 -0700 (PDT) X-Received: by 10.14.223.1 with SMTP id u1mr39831734eep.10.1378824599406; Tue, 10 Sep 2013 07:49:59 -0700 (PDT) Received: from mail-ea0-f179.google.com (mail-ea0-f179.google.com [209.85.215.179]) by mx.google.com with ESMTPS id 7si15272797eeu.338.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.179 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.179; Received: by mail-ea0-f179.google.com with SMTP id b10so3915505eae.38 for ; Tue, 10 Sep 2013 07:49:58 -0700 (PDT) X-Received: by 10.14.211.4 with SMTP id v4mr2824748eeo.81.1378824598713; Tue, 10 Sep 2013 07:49:58 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id i1sm31911644eeg.0.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:58 -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 v3 26/27] xen/arm: Check if the device is available before using it Date: Tue, 10 Sep 2013 15:49:14 +0100 Message-Id: <1378824555-16564-27-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1378824555-16564-1-git-send-email-julien.grall@linaro.org> References: <1378824555-16564-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.128.175 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 )