Skip to content
Snippets Groups Projects
Commit 106cce96 authored by Simon Glass's avatar Simon Glass
Browse files

fdt: Tighten up error handling in fdtdec_get_pci_addr()


This function returns -ENOENT when the property is missing (which the caller
might forgive) and also when the property is present but incorrectly
formatted (which many callers would like to report).

Update the error return value to allow these different situations to be
distinguished.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Reviewed-by: default avatarTom Rini <trini@konsulko.com>
Reviewed-by: default avatarBin Meng <bmeng.cn@gmail.com>
parent cc5e196e
No related branches found
No related tags found
No related merge requests found
...@@ -327,7 +327,9 @@ fdt_addr_t fdtdec_get_addr_size(const void *blob, int node, ...@@ -327,7 +327,9 @@ fdt_addr_t fdtdec_get_addr_size(const void *blob, int node,
* @param type pci address type (FDT_PCI_SPACE_xxx) * @param type pci address type (FDT_PCI_SPACE_xxx)
* @param prop_name name of property to find * @param prop_name name of property to find
* @param addr returns pci address in the form of fdt_pci_addr * @param addr returns pci address in the form of fdt_pci_addr
* @return 0 if ok, negative on error * @return 0 if ok, -ENOENT if the property did not exist, -EINVAL if the
* format of the property was invalid, -ENXIO if the requested
* address type was not found
*/ */
int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type, int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type,
const char *prop_name, struct fdt_pci_addr *addr); const char *prop_name, struct fdt_pci_addr *addr);
......
...@@ -160,8 +160,10 @@ int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type, ...@@ -160,8 +160,10 @@ int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type,
} }
} }
if (i == num) if (i == num) {
ret = -ENXIO;
goto fail; goto fail;
}
return 0; return 0;
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment