Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19152975 authored by Ben Dooks's avatar Ben Dooks Committed by Linus Torvalds
Browse files

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: default avatarBen Dooks <ben@simtec.co.uk>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b8978784
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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;