From: Ben Dooks Date: Tue, 18 Aug 2009 21:11:17 +0000 (-0700) Subject: spi_s3c24xx: fix transfer setup code X-Git-Tag: v2.6.31-rc7~20 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=191529756633052680dd9d23ad63744ca5aa02a1;p=linux.git spi_s3c24xx: fix transfer setup code 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 Cc: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c index 590be85c8f3d..3f3119d760db 100644 --- a/drivers/spi/spi_s3c24xx.c +++ b/drivers/spi/spi_s3c24xx.c @@ -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;