diff options
-rw-r--r-- | drivers/of/of_pci.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c index 3d4cb7090878..0162e4ba30e2 100644 --- a/drivers/of/of_pci.c +++ b/drivers/of/of_pci.c @@ -105,17 +105,14 @@ EXPORT_SYMBOL_GPL(of_pci_parse_bus_range); */ int of_get_pci_domain_nr(struct device_node *node) { - const __be32 *value; - int len; - u16 domain; - - value = of_get_property(node, "linux,pci-domain", &len); - if (!value || len < sizeof(*value)) - return -EINVAL; + u32 domain; + int error; - domain = (u16)be32_to_cpup(value); + error = of_property_read_u32(node, "linux,pci-domain", &domain); + if (error) + return error; - return domain; + return (u16)domain; } EXPORT_SYMBOL_GPL(of_get_pci_domain_nr); |