mtd: devices: fix mchp23k256 read and write
authorAngelo Dureghello <angelo.dureghello@timesys.com>
Wed, 30 Oct 2019 11:39:57 +0000 (12:39 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Jan 2020 07:22:57 +0000 (08:22 +0100)
commitacc5e1a86abaf6483db48ac6e8a225ca018df11c
tree365d88c841d1f57819db6a78f1967541ec73425f
parent835d761721807737f31a77596a0a28c4a4d84935
mtd: devices: fix mchp23k256 read and write

commit 14f89e088155314d311e4d4dd9f2b4ccaeef92b2 upstream.

Due to the use of sizeof(), command size set for the spi transfer
was wrong. Driver was sending and receiving always 1 byte less
and especially on write, it was hanging.

echo -n -e "\\x1\\x2\\x3\\x4" > /dev/mtd1

And read part too now works as expected.

hexdump -C -n16 /dev/mtd1
00000000  01 02 03 04 ab f3 ad c2  ab e3 f4 36 dd 38 04 15
00000010

Fixes: 4379075a870b ("mtd: mchp23k256: Add support for mchp23lcv1024")
Signed-off-by: Angelo Dureghello <angelo.dureghello@timesys.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/devices/mchp23k256.c