Commit 6282f122 authored by Boris Brezillon's avatar Boris Brezillon Committed by Mark Brown

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: b95cb394 ("spi: ti-qspi: Implement the spi_mem interface")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent e935dba1
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment