diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-09-24 03:54:51 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-24 06:02:34 -0400 |
commit | 9553821ead2b6e813a8b3a5360e20e28bfabc177 (patch) | |
tree | 82754a716d5b123fdde630f15596ed6e1be42191 /drivers/spi | |
parent | 4a10c2ac2f368583138b774ca41fac4207911983 (diff) |
spi: spi-topcliff-pch: fix a pci_iomap() check
If pci_iomap() returns NULL, adding "PCH_ADDRESS_SIZE * plat_dev->id"
can make it non-NULL which breaks the error handling.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-topcliff-pch.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c index eaeeed51bbbf..777c40452bd1 100644 --- a/drivers/spi/spi-topcliff-pch.c +++ b/drivers/spi/spi-topcliff-pch.c | |||
@@ -1410,13 +1410,13 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev) | |||
1410 | /* baseaddress + address offset) */ | 1410 | /* baseaddress + address offset) */ |
1411 | data->io_base_addr = pci_resource_start(board_dat->pdev, 1) + | 1411 | data->io_base_addr = pci_resource_start(board_dat->pdev, 1) + |
1412 | PCH_ADDRESS_SIZE * plat_dev->id; | 1412 | PCH_ADDRESS_SIZE * plat_dev->id; |
1413 | data->io_remap_addr = pci_iomap(board_dat->pdev, 1, 0) + | 1413 | data->io_remap_addr = pci_iomap(board_dat->pdev, 1, 0); |
1414 | PCH_ADDRESS_SIZE * plat_dev->id; | ||
1415 | if (!data->io_remap_addr) { | 1414 | if (!data->io_remap_addr) { |
1416 | dev_err(&plat_dev->dev, "%s pci_iomap failed\n", __func__); | 1415 | dev_err(&plat_dev->dev, "%s pci_iomap failed\n", __func__); |
1417 | ret = -ENOMEM; | 1416 | ret = -ENOMEM; |
1418 | goto err_pci_iomap; | 1417 | goto err_pci_iomap; |
1419 | } | 1418 | } |
1419 | data->io_remap_addr += PCH_ADDRESS_SIZE * plat_dev->id; | ||
1420 | 1420 | ||
1421 | dev_dbg(&plat_dev->dev, "[ch%d] remap_addr=%p\n", | 1421 | dev_dbg(&plat_dev->dev, "[ch%d] remap_addr=%p\n", |
1422 | plat_dev->id, data->io_remap_addr); | 1422 | plat_dev->id, data->io_remap_addr); |