diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-09-17 05:50:23 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@linux.intel.com> | 2012-09-17 23:34:52 -0400 |
commit | 61c6e7531d3b66b33187b8cdd700fd8ab93ffd62 (patch) | |
tree | e65fdbc3eae97f10ba118a9e151a71655b778a44 /drivers/dma | |
parent | 2e2c682becb20416c140aa0d6d3137b51a5c76da (diff) |
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')
-rw-r--r-- | drivers/dma/pl330.c | 5 |
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) | |||
2930 | num_chan = max_t(int, pi->pcfg.num_peri, pi->pcfg.num_chan); | 2930 | num_chan = max_t(int, pi->pcfg.num_peri, pi->pcfg.num_chan); |
2931 | 2931 | ||
2932 | pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL); | 2932 | pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL); |
2933 | if (!pdmac->peripherals) { | ||
2934 | ret = -ENOMEM; | ||
2935 | dev_err(&adev->dev, "unable to allocate pdmac->peripherals\n"); | ||
2936 | goto probe_err5; | ||
2937 | } | ||
2933 | 2938 | ||
2934 | for (i = 0; i < num_chan; i++) { | 2939 | for (i = 0; i < num_chan; i++) { |
2935 | pch = &pdmac->peripherals[i]; | 2940 | pch = &pdmac->peripherals[i]; |