summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi-nor
diff options
context:
space:
mode:
authorHan Xu <han.xu@nxp.com>2016-01-07 13:21:02 -0600
committerNitin Garg <nitin.garg@nxp.com>2016-01-14 11:03:07 -0600
commit5dbd548b8c537c25ab3a1095fd63b9abe50f33b6 (patch)
tree201334ba7c96d092e603f62b3566f322c4a9655e /drivers/mtd/spi-nor
parent918e21fd7940adfe1ed5a191dabe7d3fa4bad9fd (diff)
MLK-12153: mtd: fsl-quadspi: fix the QSPI dereference null return value found by coverity
check the return value to avoid the dereference null return value when parsing device tree. Signed-off-by: Han Xu <han.xu@nxp.com>
Diffstat (limited to 'drivers/mtd/spi-nor')
-rw-r--r--drivers/mtd/spi-nor/fsl-quadspi.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index e6cd64193a54..ccda2961bc5d 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -1041,12 +1041,21 @@ static int fsl_qspi_probe(struct platform_device *pdev)
/* find the resources */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "QuadSPI");
+ if (!res) {
+ dev_err(dev, "QuadSPI get resource IORESOURCE_MEM failed\n");
+ return -ENODEV;
+ }
q->iobase = devm_ioremap_resource(dev, res);
if (IS_ERR(q->iobase))
return PTR_ERR(q->iobase);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"QuadSPI-memory");
+ if (!res) {
+ dev_err(dev,
+ "QuadSPI-memory get resource IORESOURCE_MEM failed\n");
+ return -ENODEV;
+ }
if (!devm_request_mem_region(dev, res->start, resource_size(res),
res->name)) {
dev_err(dev, "can't request region for resource %pR\n", res);