1
0
Fork 0
remarkable-uboot/drivers/mtd
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
..
nand arasan: nfc: Add initial nand driver support for arasan 2016-02-12 17:27:41 -06:00
onenand mtd, ubi, ubifs: resync with Linux-3.14 2014-08-25 19:25:55 -04:00
spi sf: Correct data types in stm_is_locked_sr() 2016-03-12 19:55:42 +05:30
ubi bug.h: move BUILD_BUG_* defines to include/linux/bug.h 2016-01-25 10:39:59 -05:00
Kconfig mtd: add altera quadspi driver 2015-11-12 08:26:58 +08:00
Makefile mtd: add altera quadspi driver 2015-11-12 08:26:58 +08:00
altera_qspi.c altera_qspi: allow ctrl-c to abort the erase ops 2015-12-28 09:32:43 +08:00
at45.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
cfi_flash.c Move console definitions into a new console.h file 2015-11-19 20:27:50 -07:00
cfi_mtd.c mtd, cfi, ubi: add missing writebufsize initialization 2014-11-19 07:54:04 +01:00
dataflash.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
ftsmc020.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
jedec_flash.c mtd: Handle 29LV800BT 2014-11-19 08:48:41 +01:00
mtd-uclass.c dm: implement a MTD uclass 2015-11-12 08:26:58 +08:00
mtd_uboot.c mtd: uboot: Add meaningful error message 2015-11-12 13:17:28 -05:00
mtdconcat.c kbuild: force to define __UBOOT__ in all the C sources 2014-09-16 12:23:56 -04:00
mtdcore.c compat: Remove is_power_of_2() definition 2015-11-05 16:46:59 -05:00
mtdcore.h mtd, ubi, ubifs: resync with Linux-3.14 2014-08-25 19:25:55 -04:00
mtdpart.c mtd: Introduce mtd_block_isreserved() 2015-08-25 22:53:57 -05:00
mw_eeprom.c Update i386 code (sc520_cdp) 2008-09-09 11:48:53 +02:00
st_smi.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00