[U-Boot] [PATCH] sf: prevent clean_bar overwriting error codes

Simon Goldschmidt simon.k.r.goldschmidt at gmail.com
Fri Feb 1 18:52:39 UTC 2019


Am 06.12.2018 um 02:31 schrieb Simon Glass:
> On Tue, 27 Nov 2018 at 13:09, Simon Goldschmidt
> <simon.k.r.goldschmidt at gmail.com> wrote:
>>
>> In spi_flash.c, if CONFIG_SPI_FLASH_BAR is enabled, the function
>> 'clean_bar' makes sure that the Bank Address Register is reset at the
>> end of functions using it.
>>
>> However, if this is enabled, those functions may return zero (success)
>> when they should return an error. This is because after e.g.
>> 'spi_flash_read_common' fails, the return value in 'ret' is overwritten
>> with the return value of 'clean_bar'.
>>
>> Fix this by changing 'clean_bar' to take the outer error code into
>> account and returning its own return value only if the outer error code
>> is 0.
>>
>> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt at gmail.com>
>> ---
>>
>>   drivers/mtd/spi/spi_flash.c | 21 +++++++++++++++------
>>   1 file changed, 15 insertions(+), 6 deletions(-)
> 
> Reviewed-by: Simon Glass <sjg at chromium.org>

This can be dropped due to Vignesh's series that updates SPI NOR.


Simon



More information about the U-Boot mailing list