From patchwork Mon Jun 3 13:24:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 2652401 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 46ECDDF24C for ; Mon, 3 Jun 2013 13:25:50 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UjUlL-0001n9-1z; Mon, 03 Jun 2013 13:25:27 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UjUl0-0007pf-ID; Mon, 03 Jun 2013 13:25:06 +0000 Received: from moutng.kundenserver.de ([212.227.126.171]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UjUkx-0007mc-Sl for linux-arm-kernel@lists.infradead.org; Mon, 03 Jun 2013 13:25:04 +0000 Received: from wuerfel.localnet (HSI-KBW-095-208-002-043.hsi5.kabel-badenwuerttemberg.de [95.208.2.43]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MUCR8-1Uswxl1qN8-00R83t; Mon, 03 Jun 2013 15:24:35 +0200 From: Arnd Bergmann To: Stephen Warren , Grant Likely Subject: [PATCH] spi: sirf: avoid uninitialized-use warning Date: Mon, 03 Jun 2013 15:24:53 +0200 Message-ID: <2423840.pM7qIRtGlE@wuerfel> User-Agent: KMail/4.10.2 (Linux/3.10.0-rc3-next-20130527+; KDE/4.10.3; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V02:K0:BuICV7d4dOPWd8Kq98cQevFtECIOy1mML/WVzs2twRT Zd2yPs2W/+0LS+9Ec8B0sbnQ68shiXfztOzT71F1O9euSmPSI5 yeeWh29PlpTpwT9yQW+F89JQ1RJo26MYsWfrThgsbeZfMm6Q/C Se0L7U7VNaBTFrndn6LtDRLAD7mDDyPDbPUdJHAfTh6Rv7nloy T4oSCJImZcFEbUVS21F3qH51QiHpFiWL/B7706gIfpezlv4whn 08aZEgt14wf7I2n0FGvMtb2eb5TbU/NmCoDXHS2KxkEDV6fAee K2m4thLJrO48+T/2PaAV3BA52mGsz4iUTEc6/I+HyD3FFnuBzd QeMIVWS75HdXXVdb8rjU= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130603_092504_149802_F33CE1AE X-CRM114-Status: UNSURE ( 8.36 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.126.171 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Mark Brown , linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 24778be20 "spi: convert drivers to use bits_per_word_mask" removed the "default" statement in the spi_sirfsoc_setup_transfer switch, causing a new warning: drivers/spi/spi-sirf.c: In function 'spi_sirfsoc_setup_transfer': arch/arm/include/asm/io.h:90:2: warning: 'rxfifo_ctrl' may be used uninitialized in this function [-Wmaybe-uninitialized] asm volatile("str %1, %0" ^ drivers/spi/spi-sirf.c:364:19: note: 'rxfifo_ctrl' was declared here u32 txfifo_ctrl, rxfifo_ctrl; ^ The compiler has correctly identified that this case may happen, but since we know that things are horribly broken if bits_per_word is ever something other than the values we tested, calling BUG() is an appropriate action and tells the compiler that execution will not continue afterwards. Signed-off-by: Arnd Bergmann Cc: Stephen Warren Cc: Mark Brown --- I keep using the wrong address for Mark even though I know it doesn't work any more. Sorry for the duplicate mail. diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 265a5c6..fc20bcf 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -409,6 +409,8 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t) rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | SIRFSOC_SPI_FIFO_WIDTH_DWORD; break; + default: + BUG(); } if (!(spi->mode & SPI_CS_HIGH))