diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spidev.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 225d6b2f82dd..bcfef04f547e 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
@@ -168,6 +168,12 @@ static int spidev_message(struct spidev_data *spidev, | |||
168 | n--, k_tmp++, u_tmp++) { | 168 | n--, k_tmp++, u_tmp++) { |
169 | k_tmp->len = u_tmp->len; | 169 | k_tmp->len = u_tmp->len; |
170 | 170 | ||
171 | total += k_tmp->len; | ||
172 | if (total > bufsiz) { | ||
173 | status = -EMSGSIZE; | ||
174 | goto done; | ||
175 | } | ||
176 | |||
171 | if (u_tmp->rx_buf) { | 177 | if (u_tmp->rx_buf) { |
172 | k_tmp->rx_buf = buf; | 178 | k_tmp->rx_buf = buf; |
173 | if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len)) | 179 | if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len)) |
@@ -179,12 +185,6 @@ static int spidev_message(struct spidev_data *spidev, | |||
179 | u_tmp->len)) | 185 | u_tmp->len)) |
180 | goto done; | 186 | goto done; |
181 | } | 187 | } |
182 | |||
183 | total += k_tmp->len; | ||
184 | if (total > bufsiz) { | ||
185 | status = -EMSGSIZE; | ||
186 | goto done; | ||
187 | } | ||
188 | buf += k_tmp->len; | 188 | buf += k_tmp->len; |
189 | 189 | ||
190 | k_tmp->cs_change = !!u_tmp->cs_change; | 190 | k_tmp->cs_change = !!u_tmp->cs_change; |