diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-10-18 01:05:31 +0300 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@free-electrons.com> | 2016-10-28 11:21:23 +0300 |
commit | 8ff0513bdcdd71e84aa561cce216675d43fb41b8 (patch) | |
tree | 5a78c67a0d77953159dbad5e57f52f95a4e9b001 /drivers/misc/cxl/api.c | |
parent | 73f907fd5fa56b0066d199bdd7126bbd04f6cd7b (diff) | |
download | linux-8ff0513bdcdd71e84aa561cce216675d43fb41b8.tar.xz |
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>
Diffstat (limited to 'drivers/misc/cxl/api.c')
0 files changed, 0 insertions, 0 deletions