summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorKiran Padwal <kiran.padwal@smartplayin.com>2014-09-18 12:57:47 +0530
committerMark Brown <broonie@kernel.org>2014-09-18 11:14:16 -0700
commit73e3f1eb51888303389f2dc2219c97ce34ca6db0 (patch)
treec80f70570e3c496d924bb47a391ec6b20b5e79c1 /drivers/spi
parent7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9 (diff)
downloadop-kernel-dev-73e3f1eb51888303389f2dc2219c97ce34ca6db0.zip
op-kernel-dev-73e3f1eb51888303389f2dc2219c97ce34ca6db0.tar.gz
spi: pl022: Add missing error check for devm_kzalloc
Currently this driver is missing a check on the return value of devm_kzalloc, which would cause a NULL pointer dereference in a OOM situation. This patch adds a missing check. Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-pl022.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c
index 1189cfd..7f13f3f 100644
--- a/drivers/spi/spi-pl022.c
+++ b/drivers/spi/spi-pl022.c
@@ -2100,6 +2100,10 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
pl022->vendor = id->data;
pl022->chipselects = devm_kzalloc(dev, num_cs * sizeof(int),
GFP_KERNEL);
+ if (!pl022->chipselects) {
+ status = -ENOMEM;
+ goto err_no_mem;
+ }
/*
* Bus Number Which has been Assigned to this SSP controller
@@ -2241,6 +2245,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
amba_release_regions(adev);
err_no_ioregion:
err_no_gpio:
+ err_no_mem:
spi_master_put(master);
return status;
}
OpenPOWER on IntegriCloud