|
@@ -312,11 +312,20 @@ static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
|
|
if (t->bits_per_word)
|
|
if (t->bits_per_word)
|
|
bits_per_word = t->bits_per_word;
|
|
bits_per_word = t->bits_per_word;
|
|
len = t->len;
|
|
len = t->len;
|
|
- if (bits_per_word > 8)
|
|
|
|
|
|
+ if (bits_per_word > 8) {
|
|
|
|
+ /* invalid length? */
|
|
|
|
+ if (len & 1)
|
|
|
|
+ return -EINVAL;
|
|
len /= 2;
|
|
len /= 2;
|
|
- if (bits_per_word > 16)
|
|
|
|
|
|
+ }
|
|
|
|
+ if (bits_per_word > 16) {
|
|
|
|
+ /* invalid length? */
|
|
|
|
+ if (len & 1)
|
|
|
|
+ return -EINVAL;
|
|
len /= 2;
|
|
len /= 2;
|
|
|
|
+ }
|
|
mpc83xx_spi->count = len;
|
|
mpc83xx_spi->count = len;
|
|
|
|
+
|
|
INIT_COMPLETION(mpc83xx_spi->done);
|
|
INIT_COMPLETION(mpc83xx_spi->done);
|
|
|
|
|
|
/* enable rx ints */
|
|
/* enable rx ints */
|