]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: parsers: bcm47xxpart: Fix halfblock reads
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 18 Oct 2022 09:11:29 +0000 (11:11 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Tue, 18 Oct 2022 09:20:12 +0000 (11:20 +0200)
commitc8df9d80c7a678cf5c084c9ec2a778ec59edc091
tree0657df5e848c95119616f4147df3b720b05ee1e6
parent51c7f684baf1fcf71ddf0cb61c1398bf8066f589
mtd: parsers: bcm47xxpart: Fix halfblock reads

There is some code in the parser that tries to read 0x8000
bytes into a block to "read in the middle" of the block. Well
that only works if the block is also 0x10000 bytes all the time,
else we get these parse errors as we reach the end of the flash:

spi-nor spi0.0: mx25l1606e (2048 Kbytes)
mtd_read error while parsing (offset: 0x200000): -22
mtd_read error while parsing (offset: 0x201000): -22
(...)

Fix the code to do what I think was intended.

Cc: stable@vger.kernel.org
Fixes: ee596e6cf1c7 ("mtd: bcm47xxpart: alternative MAGIC for board_data partition")
Cc: Rafał Miłecki <zajec5@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20221018091129.280026-1-linus.walleij@linaro.org
drivers/mtd/parsers/bcm47xxpart.c