linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: spi-bfin5xx: Initialize cr_width in bfin_spi_pump_transfers()
@ 2015-04-01 19:03 Chen Gang
  2015-04-01 20:29 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Gang @ 2015-04-01 19:03 UTC (permalink / raw)
  To: broonie; +Cc: linux-spi, linux-kernel

cr_width may be not initialized before using by cr, the related warning
(with defconfig under blackfin by gcc5):

    CC      drivers/spi/spi-bfin5xx.o
  drivers/spi/spi-bfin5xx.c: In function 'bfin_spi_pump_transfers':
  drivers/spi/spi-bfin5xx.c:655:5: warning: 'cr_width' may be used uninitialized in this function [-Wmaybe-uninitialized]
    cr |= cr_width;
       ^

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 drivers/spi/spi-bfin5xx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c
index 3707993..a3d65b4 100644
--- a/drivers/spi/spi-bfin5xx.c
+++ b/drivers/spi/spi-bfin5xx.c
@@ -559,7 +559,7 @@ static void bfin_spi_pump_transfers(unsigned long data)
 	struct spi_transfer *previous = NULL;
 	struct bfin_spi_slave_data *chip = NULL;
 	unsigned int bits_per_word;
-	u16 cr, cr_width, dma_width, dma_config;
+	u16 cr, cr_width = 0, dma_width, dma_config;
 	u32 tranf_success = 1;
 	u8 full_duplex = 0;
 
@@ -648,7 +648,6 @@ static void bfin_spi_pump_transfers(unsigned long data)
 	} else if (bits_per_word == 8) {
 		drv_data->n_bytes = bits_per_word/8;
 		drv_data->len = transfer->len;
-		cr_width = 0;
 		drv_data->ops = &bfin_bfin_spi_transfer_ops_u8;
 	}
 	cr = bfin_read(&drv_data->regs->ctl) & ~(BIT_CTL_TIMOD | BIT_CTL_WORDSIZE);
-- 
1.9.3

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

* Re: [PATCH] spi: spi-bfin5xx: Initialize cr_width in bfin_spi_pump_transfers()
  2015-04-01 19:03 [PATCH] spi: spi-bfin5xx: Initialize cr_width in bfin_spi_pump_transfers() Chen Gang
@ 2015-04-01 20:29 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-04-01 20:29 UTC (permalink / raw)
  To: Chen Gang; +Cc: linux-spi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 194 bytes --]

On Thu, Apr 02, 2015 at 03:03:33AM +0800, Chen Gang wrote:
> cr_width may be not initialized before using by cr, the related warning
> (with defconfig under blackfin by gcc5):

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2015-04-01 20:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-01 19:03 [PATCH] spi: spi-bfin5xx: Initialize cr_width in bfin_spi_pump_transfers() Chen Gang
2015-04-01 20:29 ` 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).