Skip to content

Commit

Permalink
spi_s3c24xx: fix transfer setup code
Browse files Browse the repository at this point in the history
Since the changes to the bitbang driver, there is the possibility we will
be called with either the speed_hz or bpw values zero.  We take these to
mean that the default values (8 bits per word, or maximum bus speed).

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Ben Dooks authored and Linus Torvalds committed Aug 18, 2009
1 parent b897878 commit 1915297
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/spi/spi_s3c24xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ static int s3c24xx_spi_setupxfer(struct spi_device *spi,
bpw = t ? t->bits_per_word : spi->bits_per_word;
hz = t ? t->speed_hz : spi->max_speed_hz;

if (!bpw)
bpw = 8;

if (!hz)
hz = spi->max_speed_hz;

if (bpw != 8) {
dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw);
return -EINVAL;
Expand Down

0 comments on commit 1915297

Please sign in to comment.