u-boot-brain/drivers/mtd/spi
Marek Vasut ea9619aed6 sf: Correct data types in stm_is_locked_sr()
The stm_is_locked_sr() function is picked from Linux kernel. For reason
unknown, the 64bit data types used by the function and present in Linux
were replaced with 32bit unsigned ones, which causes trouble.

The testcase performed was done using ST M25P80 chip.
The command used was:
 => sf protect unlock 0 0x10000

The call chain starts in stm_unlock(), which calls stm_is_locked_sr()
with negative ofs argument. This works fine in Linux, where the "ofs"
is loff_t, which is signed long long, while this fails in U-Boot, where
"ofs" is u32 (unsigned int). Because of this signedness problem, the
expression past the return statement to be incorrectly evaluated to 1,
which in turn propagates back to stm_unlock() and results in -EINVAL.

The correction is very simple, just use the correctly sized data types
with correct signedness in the function to make it work as intended.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jteki@openedev.com>
2016-03-12 19:55:42 +05:30
..
fsl_espi_spl.c driver: Add support of image load for MMC & SPI in SPL 2014-04-22 17:58:50 -07:00
Kconfig sf: Make 4K sector support configurable 2015-08-17 15:59:48 +05:30
Makefile sf: Rename sf_ops.c to spi-flash.c 2015-12-11 22:12:24 +05:30
sandbox.c sandbox: spi: Remove an incorrect free() 2016-02-26 08:53:10 -07:00
sf_dataflash.c dm: Rename dev_get_parentdata() to dev_get_parent_priv() 2015-10-23 09:42:28 -06:00
sf_internal.h sf: Make IO modes at last in read modes 2016-01-13 18:47:27 +05:30
sf_mtd.c mtd, spi: Add MTD layer driver 2015-06-30 00:40:11 +05:30
sf_params.c sf: params: Add IS25LP128 part support 2015-10-25 20:17:03 +05:30
sf_probe.c spi: Correct two error return values 2016-02-26 08:53:10 -07:00
sf-uclass.c dm: spi_flash: Allow the uclass to work without printf() 2016-01-15 05:39:27 -07:00
sf.c sf: Add CONFIG_SF_DUAL_FLASH 2014-01-12 21:40:22 +05:30
spi_flash.c sf: Correct data types in stm_is_locked_sr() 2016-03-12 19:55:42 +05:30
spi_spl_load.c spl: change return values of spl_*_load_image() 2015-11-18 14:50:02 -05:00