]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
x86: mrccache: Fix error handling in mrccache_get_region()
authorSimon Glass <sjg@chromium.org>
Mon, 26 Sep 2016 03:33:40 +0000 (21:33 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Tue, 11 Oct 2016 03:55:33 +0000 (11:55 +0800)
This should return normal errors, not device-tree errors. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/lib/mrccache.c

index 67bace4f40df6bb06e1fc3ec8022c9b9fd6ec079..eca88ac8b9f1707785bd5e87734a38b8b443c27e 100644 (file)
@@ -198,11 +198,13 @@ int mrccache_get_region(struct udevice **devp, struct mrc_region *entry)
 
        /* Find the flash chip within the SPI controller node */
        node = fdtdec_next_compatible(blob, 0, COMPAT_GENERIC_SPI_FLASH);
-       if (node < 0)
+       if (node < 0) {
+               debug("%s: Cannot find SPI flash\n", __func__);
                return -ENOENT;
+       }
 
        if (fdtdec_get_int_array(blob, node, "memory-map", reg, 2))
-               return -FDT_ERR_NOTFOUND;
+               return -EINVAL;
        entry->base = reg[0];
 
        /* Find the place where we put the MRC cache */
@@ -211,7 +213,7 @@ int mrccache_get_region(struct udevice **devp, struct mrc_region *entry)
                return -EPERM;
 
        if (fdtdec_get_int_array(blob, mrc_node, "reg", reg, 2))
-               return -FDT_ERR_NOTFOUND;
+               return -EINVAL;
        entry->offset = reg[0];
        entry->length = reg[1];