From patchwork Fri Sep 13 12:49:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 20051 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f199.google.com (mail-ye0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 91D8928EA3 for ; Fri, 13 Sep 2013 12:50:12 +0000 (UTC) Received: by mail-ye0-f199.google.com with SMTP id l4sf1134223yen.2 for ; Fri, 13 Sep 2013 05:50:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version: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=NbQUylvnV30LfsFDbMIMJElgj5rgge99PtOdbZsP7EbTz3Cj0mjhTnT0iKB0hV9gyu jM2qBEenQ7zWMiJDspKqNe27TJ+weSrf0ErRYXCoxUU4XJVetR1yoL7mHaYc4J4+2/se gZ8l5Bh7sdRuswl7AribOs1yBOGT4VKxMc6Lpi4W2cyGWBY9xsGpzKVzRb1x9k5D65sH SwL2uPMAxP3K+joGbCUdt+uNhTPCDmUycm8Baq76axlxUAvFOWA+LVDkClGddXrC2CDl zd2D9qkk+7fvBNEiozpAU+v3Vw1zFzfr9ONh0aw5Ap//9dwbdEufpJ+Um/PRXlIhCf+a OYXQ== X-Gm-Message-State: ALoCoQlcSti2qUtFiG7AFizf9WhoYvutJiN3Ollm6hmQqB05O8tDWKYEV+NYhBezJxI96niCXbL0 X-Received: by 10.236.163.67 with SMTP id z43mr4898695yhk.27.1379076612337; Fri, 13 Sep 2013 05:50:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.17.98 with SMTP id n2ls1089534qed.12.gmail; Fri, 13 Sep 2013 05:50:12 -0700 (PDT) X-Received: by 10.220.145.75 with SMTP id c11mr182956vcv.30.1379076612125; Fri, 13 Sep 2013 05:50:12 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id gq10si3060847vdc.121.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:50:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.172 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.172; Received: by mail-ve0-f172.google.com with SMTP id oz11so932726veb.3 for ; Fri, 13 Sep 2013 05:50:12 -0700 (PDT) X-Received: by 10.220.91.16 with SMTP id k16mr7127269vcm.21.1379076612036; Fri, 13 Sep 2013 05:50:12 -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 u4csp78803vcz; Fri, 13 Sep 2013 05:50:11 -0700 (PDT) X-Received: by 10.15.108.202 with SMTP id cd50mr2731126eeb.68.1379076611051; Fri, 13 Sep 2013 05:50:11 -0700 (PDT) Received: from mail-ea0-f177.google.com (mail-ea0-f177.google.com [209.85.215.177]) by mx.google.com with ESMTPS id q8si3777354eem.0.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:50:11 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.177 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.177; Received: by mail-ea0-f177.google.com with SMTP id f15so546323eak.8 for ; Fri, 13 Sep 2013 05:50:10 -0700 (PDT) X-Received: by 10.15.67.131 with SMTP id u3mr17992555eex.34.1379076610410; Fri, 13 Sep 2013 05:50:10 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id p5sm14678420eeg.5.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:50:10 -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 v4 26/27] xen/arm: Check if the device is available before using it Date: Fri, 13 Sep 2013 13:49:33 +0100 Message-Id: <1379076574-28316-27-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1379076574-28316-1-git-send-email-julien.grall@linaro.org> References: <1379076574-28316-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.172 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 )