]> Git Repo - u-boot.git/commitdiff
fdt: Tighten up error handling in fdtdec_get_pci_addr()
authorSimon Glass <[email protected]>
Thu, 5 Mar 2015 19:25:19 +0000 (12:25 -0700)
committerSimon Glass <[email protected]>
Fri, 17 Apr 2015 01:27:42 +0000 (19:27 -0600)
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: Simon Glass <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
include/fdtdec.h
lib/fdtdec.c

index 967fa88f9ec1d53352c7eb940c43ad26ad941baa..c39ad90f02097063e2297c1909d45a207b6d2cbb 100644 (file)
@@ -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 prop_name    name of property to find
  * @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,
                const char *prop_name, struct fdt_pci_addr *addr);
index 915fe2444a80c56837532a0ab2289ace8f935f51..fa7da8963c84a41985dbf03d36d31ebd6d283102 100644 (file)
@@ -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;
+               }
 
                return 0;
        } else {
This page took 0.037724 seconds and 4 git commands to generate.