summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJubeom Kim <jubeomk@nvidia.com>2011-06-22 23:29:32 +0900
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:47:35 -0800
commit5d1d834cbfd8499af29af4af171b47ace6faa1d6 (patch)
tree2b743595d083f65531f43f5168016fdefb47581d /drivers
parent717f805865f551974d82c2877beb1538a94697fb (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. Reviewed-on: http://git-master/r/37868 (cherry picked from commit 4c0d22c83294ca081e90f588fdcb67fdc54fff23) Original-Change-Id: Ic37df9d29e305699abeda1f8b8aa48b7fcd9b394 Reviewed-on: http://git-master/r/39583 Tested-by: Jubeom Kim <jubeomk@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: R8e088031295c334cf3026ee8a49738605b7fcf7f
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/spi-tegra.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c
index 11efbe536e29..3f36ea944de6 100644
--- a/drivers/spi/spi-tegra.c
+++ b/drivers/spi/spi-tegra.c
@@ -381,7 +381,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);
@@ -1037,7 +1037,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) {
@@ -1081,12 +1081,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,