linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.7] spi/bcm63xx: fix transfer bits_per_words check
@ 2012-11-24 13:44 Jonas Gorski
       [not found] ` <1353764690-5961-1-git-send-email-jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
       [not found] ` <20121124172801.GC4719@opensource.wolfsonmicro.com>
  0 siblings, 2 replies; 6+ messages in thread
From: Jonas Gorski @ 2012-11-24 13:44 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: Kevin Cernekee, Mark Brown, stable-u79uwXL29TY76Z2rM5mHXA,
	Maxime Bizon, Florian Fainelli

Transfers often do not have bits_per_words set, so use the spi device's
bits_per_words in this case.

This fixes the driver rejecting valid transfers e.g. generated by
spi_write() or spi_read().

Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Jonas Gorski <jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/spi/spi-bcm63xx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c
index a9f4049..d7c2916 100644
--- a/drivers/spi/spi-bcm63xx.c
+++ b/drivers/spi/spi-bcm63xx.c
@@ -103,7 +103,8 @@ static int bcm63xx_spi_check_transfer(struct spi_device *spi,
 {
 	u8 bits_per_word;
 
-	bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word;
+	bits_per_word = (t && t->bits_per_word) ?
+			t->bits_per_word : spi->bits_per_word;
 	if (bits_per_word != 8) {
 		dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
 			__func__, bits_per_word);
-- 
1.7.10.4


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-26 13:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-24 13:44 [PATCH 3.7] spi/bcm63xx: fix transfer bits_per_words check Jonas Gorski
     [not found] ` <1353764690-5961-1-git-send-email-jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-11-24 15:02   ` Florian Fainelli
     [not found] ` <20121124172801.GC4719@opensource.wolfsonmicro.com>
     [not found]   ` <20121124172801.GC4719-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-11-24 17:53     ` Jonas Gorski
     [not found]       ` <20121124180151.GJ4719@opensource.wolfsonmicro.com>
     [not found]         ` <20121124180151.GJ4719-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-11-24 18:19           ` Jonas Gorski
2012-11-26 13:11             ` Florian Fainelli
2012-11-26 13:23               ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).