summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@bootlin.com>2018-05-14 11:11:29 +0200
committerMark Brown <broonie@kernel.org>2018-05-17 06:36:00 +0200
commit6282f122913e632c2415c236a2b5faa8ef368b10 (patch)
treecaf37309a29de025cc9785ab99b8d0914ad82a47 /drivers/spi
parentspi: spi-s3c64xx: Fix system resume support (diff)
downloadlinux-6282f122913e632c2415c236a2b5faa8ef368b10.tar.xz
linux-6282f122913e632c2415c236a2b5faa8ef368b10.zip
spi: ti-qspi: Make sure res_mmap != NULL before dereferencing it
resource_size() is dereferencing the res without checking that it is not NULL, so we need to do the check before calling resource_size(). Fixes: b95cb394ab59 ("spi: ti-qspi: Implement the spi_mem interface") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-ti-qspi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index c54b760e00ed..5f19016bbf10 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -718,7 +718,9 @@ static int ti_qspi_probe(struct platform_device *pdev)
"memory mapped resource not required\n");
}
}
- qspi->mmap_size = resource_size(res_mmap);
+
+ if (res_mmap)
+ qspi->mmap_size = resource_size(res_mmap);
irq = platform_get_irq(pdev, 0);
if (irq < 0) {