diff options
author | Julien Grall <julien.grall@linaro.org> | 2013-09-13 13:49:33 +0100 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2013-09-17 15:29:16 +0100 |
commit | 735d865183306c85c8ef8a16f8a82c48359e9bee (patch) | |
tree | 17b8d3ad0fd5533b0eeb0ab9488d20c5e196c463 /xen | |
parent | c3cc9e6c4b5dfb6741b8751b608b5c872d829604 (diff) | |
download | xen-735d865183306c85c8ef8a16f8a82c48359e9bee.tar.gz xen-735d865183306c85c8ef8a16f8a82c48359e9bee.tar.bz2 xen-735d865183306c85c8ef8a16f8a82c48359e9bee.zip |
xen/arm: Check if the device is available before using it
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 <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'xen')
-rw-r--r-- | xen/arch/arm/device.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c index dc751a979a..f86b2e3f33 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 ) |