1
0
Fork 0
remarkable-linux/drivers/mtd/nand
Arnd Bergmann 8ff0513bdc mtd: mtk: avoid warning in mtk_ecc_encode
When building with -Wmaybe-uninitialized, gcc produces a silly false positive
warning for the mtk_ecc_encode function:

drivers/mtd/nand/mtk_ecc.c: In function 'mtk_ecc_encode':
drivers/mtd/nand/mtk_ecc.c:402:15: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]

The function for some reason contains a double byte swap on big-endian
builds to get the OOB data into the correct order again, and is written
in a slightly confusing way.

Using a simple memcpy32_fromio() to read the data simplifies it a lot
so it becomes more readable and produces no warning. However, the
output might not have 32-bit alignment, so we have to use another
memcpy to avoid taking alignment faults or writing beyond the end
of the array.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: RogerCC Lin <rogercc.lin@mediatek.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2016-10-28 10:21:23 +02:00
..
bcm47xxnflash mtd: nand: make use of nand_set/get_controller_data() helpers 2016-01-07 10:23:41 -08:00
brcmnand mtd: brcmnand: iProc big endian and ONFI support 2016-09-23 09:35:16 +02:00
gpmi-nand mtd: nand: gpmi: disable the clocks on errors 2016-10-28 09:58:05 +02:00
Kconfig mtd: nand: Allow MTD_NAND_OMAP2 to be usable on Keystone devices 2016-09-23 09:35:16 +02:00
Makefile mtd: mediatek: driver for MTK Smart Device 2016-07-11 08:39:54 +02:00
ams-delta.c mtd: nand: ams-delta: set ECC algorithm explicitly 2016-04-19 22:05:31 +02:00
atmel_nand.c Revert "mtd: atmel_nand: Support variable RB_EDGE interrupts" 2016-05-25 20:06:28 -07:00
atmel_nand_ecc.h mtd: atmel_nand: Support 32-bit ECC strength 2016-02-12 10:27:48 -08:00
atmel_nand_nfc.h Revert "mtd: atmel_nand: Support variable RB_EDGE interrupts" 2016-05-25 20:06:28 -07:00
au1550nd.c mtd: nand: au1550nd: set ECC algorithm explicitly 2016-05-05 23:51:53 +02:00
bf5xx_nand.c mtd: nand: import nand_hw_control_init() 2016-09-23 09:35:16 +02:00
cafe_nand.c mtd: nand: cafe: switch to mtd_ooblayout_ops 2016-05-05 23:51:39 +02:00
cmx270_nand.c mtd: nand: cmx270: set ECC algorithm explicitly 2016-05-05 23:51:54 +02:00
cs553x_nand.c mtd: nand: remove useless mtd->priv = chip assignments 2015-12-18 13:21:40 -08:00
davinci_nand.c mtd: nand: davinci: Reinitialize the HW ECC engine in 4bit hwctl 2016-09-09 19:39:33 -07:00
denali.c mtd: nand: denali: switch to mtd_ooblayout_ops 2016-05-05 23:51:40 +02:00
denali.h mtd: nand: denali: use the mtd instance embedded in struct nand_chip 2015-12-18 13:13:50 -08:00
denali_dt.c mtd: nand: drop owner assignment from platform_drivers 2014-10-20 16:20:58 +02:00
denali_pci.c mtd: denali_pci: switch to dev_err() 2015-08-18 17:21:37 -07:00
diskonchip.c mtd: nand: diskonchip: switch to mtd_ooblayout_ops 2016-05-05 23:51:40 +02:00
docg4.c mtd: nand: import nand_hw_control_init() 2016-09-23 09:35:16 +02:00
fsl_elbc_nand.c mtd: nand: import nand_hw_control_init() 2016-09-23 09:35:16 +02:00
fsl_ifc_nand.c mtd: nand: import nand_hw_control_init() 2016-09-23 09:35:16 +02:00
fsl_upm.c mtd: nand: fsl_upm: set ECC algorithm explicitly 2016-05-05 23:51:54 +02:00
fsmc_nand.c mtd: mtd: drop NAND_ECC_SOFT_BCH enum value 2016-05-05 23:55:13 +02:00
gpio.c mtd: nand: gpio: set ECC algorithm explicitly 2016-04-19 22:05:31 +02:00
hisi504_nand.c mtd: nand: hisi504: rely on generic DT parsing done in nand_scan_ident() 2016-05-05 23:51:58 +02:00
jz4740_nand.c mtd: nand: jz4740: Remove unused local variable 2016-05-05 23:51:56 +02:00
jz4780_bch.c mtd: nand: jz4780: Update MODULE_AUTHOR email address 2016-07-11 08:40:19 +02:00
jz4780_bch.h mtd: nand: jz4780: driver for NAND devices on JZ4780 SoCs 2016-01-07 09:35:11 -08:00
jz4780_nand.c mtd: nand: import nand_hw_control_init() 2016-09-23 09:35:16 +02:00
lpc32xx_mlc.c mtd: nand: lpc32xx: switch to mtd_ooblayout_ops 2016-05-05 23:51:45 +02:00
lpc32xx_slc.c mtd: nand: lpc32xx: rely on generic DT parsing done in nand_scan_ident() 2016-05-05 23:51:58 +02:00
mpc5121_nfc.c mtd: nand: mpc5121_nfc: set ECC algorithm explicitly 2016-05-05 23:51:53 +02:00
mtk_ecc.c mtd: mtk: avoid warning in mtk_ecc_encode 2016-10-28 10:21:23 +02:00
mtk_ecc.h mtd: mediatek: driver for MTK Smart Device 2016-07-11 08:39:54 +02:00
mtk_nand.c mtd: nand: fix chances to create incomplete ECC data when writing 2016-09-19 11:57:04 +02:00
mxc_nand.c MTD updates for 4.9-rc1 2016-10-10 17:39:51 -07:00
nand_base.c mtd: nand: Fix data interface configuration logic 2016-10-28 09:58:36 +02:00
nand_bbt.c mtd: nand_bbt: scan for next free bbt block if writing bbt fails 2016-09-23 09:35:16 +02:00
nand_bch.c mtd: nand_bch: fix spelling of "probably" 2016-05-06 09:45:45 -07:00
nand_ecc.c mtd: nand: return consistent error codes in ecc.correct() implementations 2016-01-06 18:45:46 -08:00
nand_ids.c mtd: nand: add ESMT manufacturer 2016-06-09 21:23:20 +02:00
nand_timings.c mtd: nand: Expose data interface for ONFI mode 0 2016-09-23 09:35:16 +02:00
nandsim.c MTD updates for v4.7: 2016-05-24 11:00:20 -07:00
ndfc.c mtd: nand: import nand_hw_control_init() 2016-09-23 09:35:16 +02:00
nuc900_nand.c mtd: nand: nuc900: set ECC algorithm explicitly 2016-04-19 22:05:32 +02:00
omap2.c mtd: nand: omap2: Don't call dma_release_channel() if dma_request_chan() failed 2016-08-29 12:54:39 -07:00
omap_elm.c mtd: omap_elm: print interrupt resource using %pr 2015-12-18 10:16:17 -08:00
orion_nand.c mtd: nand: orion: set ECC algorithm explicitly 2016-04-19 22:05:33 +02:00
pasemi_nand.c mtd: nand: pasemi: switch to dev_* printing functions 2016-04-19 22:05:35 +02:00
plat_nand.c mtd: nand: plat: set ECC algorithm explicitly 2016-04-19 22:05:34 +02:00
pxa3xx_nand.c mtd: nand: import nand_hw_control_init() 2016-09-23 09:35:16 +02:00
qcom_nandc.c mtd: nand: import nand_hw_control_init() 2016-09-23 09:35:16 +02:00
r852.c mtd: nand: make use of nand_set/get_controller_data() helpers 2016-01-07 10:23:41 -08:00
r852.h mtd: nand: r852: use the mtd instance embedded in struct nand_chip 2015-12-18 10:54:41 -08:00
s3c2410.c mtd: nand: s3c2410: Register cpufreq notifier only on S3C24xx 2016-09-23 09:35:16 +02:00
sh_flctl.c mtd: nand: sh_flctl: handle dma_submit() errors 2016-09-23 09:35:16 +02:00
sharpsl.c mtd: nand: sharpsl: switch to mtd_ooblayout_ops 2016-05-05 23:51:36 +02:00
sm_common.c mtd: nand: sm_common: switch to mtd_ooblayout_ops 2016-05-05 23:51:48 +02:00
sm_common.h mtd: use __packed shorthand 2014-08-19 11:53:08 -07:00
socrates_nand.c mtd: nand: socrates: set ECC algorithm explicitly 2016-04-19 22:05:35 +02:00
sunxi_nand.c mtd: nand: sunxi: Support ECC maximization 2016-09-23 09:35:16 +02:00
tmio_nand.c mtd: nand: remove useless mtd->priv = chip assignments 2015-12-18 13:21:40 -08:00
txx9ndfmc.c mtd: nand: import nand_hw_control_init() 2016-09-23 09:35:16 +02:00
vf610_nfc.c mtd: nand: vf610: switch to mtd_ooblayout_ops 2016-05-05 23:51:48 +02:00
xway_nand.c mtd: nand: xway: add nandaddr to own struct 2016-07-11 08:40:17 +02:00