drivers: spi: consider command bytes when sending transfers
[oweals/u-boot.git] / drivers / mtd / spi / spi_flash.c
index e40e1c01deb369727ac5b820b00c7c643ae9b25e..294d9f9d79c6eb123dec396bd56fac801d8da860 100644 (file)
@@ -405,7 +405,7 @@ int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 offset,
 
                if (spi->max_write_size)
                        chunk_len = min(chunk_len,
-                                       (size_t)spi->max_write_size);
+                                       spi->max_write_size - sizeof(cmd));
 
                spi_flash_addr(write_addr, cmd);