Skip to content

Commit

Permalink
Merge pull request cb22#63 from roadrunner2/small-fixes
Browse files Browse the repository at this point in the history
Small fixes
  • Loading branch information
cb22 authored Mar 14, 2018
2 parents 0301500 + 917d8bc commit aeb7ca9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions applespi.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* of exchanges: reads, and writes. A read is signaled by a GPE, upon which one
* message can be read from the device. A write exchange consists of writing a
* command message, immediately reading a short status packet, and then, upon
* receiving a GPE, reading the response messsage. Write exchanges cannot be
* receiving a GPE, reading the response message. Write exchanges cannot be
* interleaved, i.e. a new write exchange must not be started till the previous
* write exchange is complete. Whether a received message is part of a read or
* write exchange is indicated in the encapsulating packet's flags field.
Expand Down Expand Up @@ -1399,15 +1399,15 @@ static void applespi_got_data(struct applespi_data *applespi)
applespi->saved_msg_len = 0;

/* got complete message - verify */
if (!applespi_verify_crc(applespi, (u8 *)message, msg_len))
goto cleanup;

if (le16_to_cpu(message->length) != msg_len - MSG_HEADER_SIZE - 2) {
dev_warn_ratelimited(&applespi->spi->dev,
"Received corrupted packet (invalid message length)\n");
goto cleanup;
}

if (!applespi_verify_crc(applespi, (u8 *)message, msg_len))
goto cleanup;

/* handle message */
if (packet->flags == PACKET_TYPE_READ &&
packet->device == PACKET_DEV_KEYB) {
Expand Down

0 comments on commit aeb7ca9

Please sign in to comment.