diff options
author | Jubeom Kim <jubeomk@nvidia.com> | 2011-06-22 23:29:32 +0900 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2011-06-26 19:17:56 -0700 |
commit | 4c0d22c83294ca081e90f588fdcb67fdc54fff23 (patch) | |
tree | 99bce23c8e9649708048c086a1acd24f5104329f /drivers | |
parent | 4299db4686321fb3017f9118a36610898f172639 (diff) |
spi: tegra: fix uninitialized values and if statement
- Initialized the read_words value.
- (tspi->irq < 0) is not valid
because tspi->irq is unsigned value.
Change-Id: I37973c863ecc770b9744737faf5d69cce7b97400
Reviewed-on: http://git-master/r/37868
Tested-by: Jubeom Kim <jubeomk@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/spi_tegra.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/spi/spi_tegra.c b/drivers/spi/spi_tegra.c index 78993ad17dcc..b640bdcc90ca 100644 --- a/drivers/spi/spi_tegra.c +++ b/drivers/spi/spi_tegra.c @@ -378,7 +378,7 @@ static unsigned int spi_tegra_read_rx_fifo_to_client_rxbuf( u8 *rx_buf = (u8 *)t->rx_buf + tspi->cur_rx_pos; unsigned i, count; unsigned long x; - unsigned int read_words; + unsigned int read_words = 0; unsigned len; fifo_status = spi_tegra_readl(tspi, SLINK_STATUS2); @@ -970,7 +970,7 @@ static int __init spi_tegra_probe(struct platform_device *pdev) struct spi_tegra_data *tspi; struct resource *r; struct tegra_spi_platform_data *pdata = pdev->dev.platform_data; - int ret; + int ret, spi_irq; master = spi_alloc_master(&pdev->dev, sizeof *tspi); if (master == NULL) { @@ -1014,12 +1014,13 @@ static int __init spi_tegra_probe(struct platform_device *pdev) goto fail_io_map; } - tspi->irq = platform_get_irq(pdev, 0); - if (unlikely(tspi->irq < 0)) { + spi_irq = platform_get_irq(pdev, 0); + if (unlikely(spi_irq < 0)) { dev_err(&pdev->dev, "can't find irq resource\n"); ret = -ENXIO; goto fail_irq_req; } + tspi->irq = spi_irq; sprintf(tspi->port_name, "tegra_spi_%d", pdev->id); ret = request_threaded_irq(tspi->irq, spi_tegra_isr, |