diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2018-05-07 01:40:34 +0000 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2018-05-07 13:31:32 +0530 |
commit | e891e41ee301a57fc74a4a0d4da60fdc9669e50c (patch) | |
tree | e783ee2f7cd1c5a4617e339c195813da3ecb1595 /drivers/dma/mic_x100_dma.c | |
parent | ab42ddb9eb71b580349b03e4fc5bfcf230422eb8 (diff) | |
download | blackbird-obmc-linux-e891e41ee301a57fc74a4a0d4da60fdc9669e50c.tar.gz blackbird-obmc-linux-e891e41ee301a57fc74a4a0d4da60fdc9669e50c.zip |
dmaengine: sprd: Fix potential NULL dereference in sprd_dma_probe()
platform_get_resource() may fail and return NULL, so we should
better check it's return value to avoid a NULL pointer dereference
a bit later in the code.
This is detected by Coccinelle semantic patch.
@@
expression pdev, res, n, t, e, e1, e2;
@@
res = platform_get_resource(pdev, t, n);
+ if (!res)
+ return -EINVAL;
... when != res == NULL
e = devm_ioremap_nocache(e1, res->start, e2);
Fixes: 9b3b8171f7f4 ("dmaengine: sprd: Add Spreadtrum DMA driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/mic_x100_dma.c')
0 files changed, 0 insertions, 0 deletions