[U-Boot] [PATCH 37/82] x86: mrccache: Fix error handling in mrccache_get_region()

Bin Meng bmeng.cn at gmail.com
Tue Oct 11 05:42:44 CEST 2016


On Tue, Oct 11, 2016 at 11:17 AM, Bin Meng <bmeng.cn at gmail.com> wrote:
> On Mon, Sep 26, 2016 at 11:33 AM, Simon Glass <sjg at chromium.org> wrote:
>> This should return normal errors, not device-tree errors. Fix it.
>>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> ---
>>
>>  arch/x86/lib/mrccache.c | 8 +++++---
>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/lib/mrccache.c b/arch/x86/lib/mrccache.c
>> index 67bace4..eca88ac 100644
>> --- a/arch/x86/lib/mrccache.c
>> +++ b/arch/x86/lib/mrccache.c
>> @@ -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];
>>
>> --
>
> Reviewed-by: Bin Meng <bmeng.cn at gmail.com>

applied to u-boot-x86, thanks!


More information about the U-Boot mailing list