diff options
Diffstat (limited to 'src/drivers/spi/spi-generic.c')
-rw-r--r-- | src/drivers/spi/spi-generic.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/drivers/spi/spi-generic.c b/src/drivers/spi/spi-generic.c index 9796663da2..e6ec7bd8d5 100644 --- a/src/drivers/spi/spi-generic.c +++ b/src/drivers/spi/spi-generic.c @@ -98,6 +98,10 @@ unsigned int spi_crop_chunk(const struct spi_slave *slave, unsigned int cmd_len, if (deduct_opcode_len) cmd_len--; + /* Subtract command length from useable buffer size. If + deduct_opcode_len is set, only subtract the number command bytes + after the opcode. If the adjusted cmd_len is larger than ctrlr_max + return 0 to inidicate an error. */ if (deduct_cmd_len) { if (ctrlr_max >= cmd_len) { ctrlr_max -= cmd_len; |