x86: mrccache: Fix error handling in mrccache_get_region()

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>
This commit is contained in:
Simon Glass 2016-09-25 21:33:40 -06:00 committed by Bin Meng
parent 9b43dbfb91
commit 54cd240731

View 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 */ /* Find the flash chip within the SPI controller node */
node = fdtdec_next_compatible(blob, 0, COMPAT_GENERIC_SPI_FLASH); 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; return -ENOENT;
}
if (fdtdec_get_int_array(blob, node, "memory-map", reg, 2)) if (fdtdec_get_int_array(blob, node, "memory-map", reg, 2))
return -FDT_ERR_NOTFOUND; return -EINVAL;
entry->base = reg[0]; entry->base = reg[0];
/* Find the place where we put the MRC cache */ /* 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; return -EPERM;
if (fdtdec_get_int_array(blob, mrc_node, "reg", reg, 2)) if (fdtdec_get_int_array(blob, mrc_node, "reg", reg, 2))
return -FDT_ERR_NOTFOUND; return -EINVAL;
entry->offset = reg[0]; entry->offset = reg[0];
entry->length = reg[1]; entry->length = reg[1];