summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2013-09-11 13:15:08 +0200
committerMark Brown <broonie@linaro.org>2013-09-12 11:53:16 +0200
commit272bfbd54f29b9361b09dbd6b25ccbd1a30163f1 (patch)
tree0dc963ec4b2bfdae84d0c5b9e93a0f6f7cdf9a92
parentMerge remote-tracking branch 'spi/topic/txx9' into spi-next (diff)
downloadlinux-272bfbd54f29b9361b09dbd6b25ccbd1a30163f1.tar.xz
linux-272bfbd54f29b9361b09dbd6b25ccbd1a30163f1.zip
spi: fix return value check in dspi_probe()
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/spi/spi-fsl-dspi.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 6cd07d13ecab..4e44575bd87a 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -476,15 +476,9 @@ static int dspi_probe(struct platform_device *pdev)
master->bus_num = bus_num;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "can't get platform resource\n");
- ret = -EINVAL;
- goto out_master_put;
- }
-
dspi->base = devm_ioremap_resource(&pdev->dev, res);
- if (!dspi->base) {
- ret = -EINVAL;
+ if (IS_ERR(dspi->base)) {
+ ret = PTR_ERR(dspi->base);
goto out_master_put;
}