summaryrefslogtreecommitdiff
path: root/drivers/dma/pl330.c
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-09-17 13:50:23 +0400
committerVinod Koul <vinod.koul@linux.intel.com>2012-09-18 07:34:52 +0400
commit61c6e7531d3b66b33187b8cdd700fd8ab93ffd62 (patch)
treee65fdbc3eae97f10ba118a9e151a71655b778a44 /drivers/dma/pl330.c
parent2e2c682becb20416c140aa0d6d3137b51a5c76da (diff)
downloadlinux-61c6e7531d3b66b33187b8cdd700fd8ab93ffd62.tar.xz
DMA: PL330: Check the pointer returned by kzalloc
kzalloc could return NULL. Hence add a check to avoid NULL pointer dereference. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Jassi Brar <jassisinghbrar@gmail.com> Cc: Stable <stable@vger.kernel.org> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/dma/pl330.c')
-rw-r--r--drivers/dma/pl330.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index a3b26ada8122..f5843bc80baa 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2930,6 +2930,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
num_chan = max_t(int, pi->pcfg.num_peri, pi->pcfg.num_chan);
pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL);
+ if (!pdmac->peripherals) {
+ ret = -ENOMEM;
+ dev_err(&adev->dev, "unable to allocate pdmac->peripherals\n");
+ goto probe_err5;
+ }
for (i = 0; i < num_chan; i++) {
pch = &pdmac->peripherals[i];