From patchwork Sat Nov 24 13:44:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 1798451 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork1.kernel.org (Postfix) with ESMTP id BFEF03FCA5 for ; Sat, 24 Nov 2012 13:44:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1TcG1x-0007lC-Eg; Sat, 24 Nov 2012 13:44:25 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1TcG1v-0007l3-MX for spi-devel-general@lists.sourceforge.net; Sat, 24 Nov 2012 13:44:23 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of gmail.com designates 209.85.214.47 as permitted sender) client-ip=209.85.214.47; envelope-from=jonas.gorski@gmail.com; helo=mail-bk0-f47.google.com; Received: from mail-bk0-f47.google.com ([209.85.214.47]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1TcG1u-0007MT-Ue for spi-devel-general@lists.sourceforge.net; Sat, 24 Nov 2012 13:44:23 +0000 Received: by mail-bk0-f47.google.com with SMTP id j4so2674011bkw.34 for ; Sat, 24 Nov 2012 05:44:16 -0800 (PST) Received: by 10.204.147.132 with SMTP id l4mr2049606bkv.20.1353764656643; Sat, 24 Nov 2012 05:44:16 -0800 (PST) Received: from shaker64.lan ([2001:470:1f0b:1abf:a00:27ff:fee0:c7df]) by mx.google.com with ESMTPS id t11sm5743247bkv.11.2012.11.24.05.44.13 (version=SSLv3 cipher=OTHER); Sat, 24 Nov 2012 05:44:15 -0800 (PST) From: Jonas Gorski To: spi-devel-general@lists.sourceforge.net Subject: [PATCH 3.7] spi/bcm63xx: fix transfer bits_per_words check Date: Sat, 24 Nov 2012 14:44:50 +0100 Message-Id: <1353764690-5961-1-git-send-email-jonas.gorski@gmail.com> X-Mailer: git-send-email 1.7.10.4 X-Spam-Score: -1.6 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (jonas.gorski[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1TcG1u-0007MT-Ue Cc: Kevin Cernekee , Mark Brown , stable@vger.kernel.org, Maxime Bizon , Florian Fainelli X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net 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@vger.kernel.org Signed-off-by: Jonas Gorski Acked-by: Florian Fainelli --- 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);