summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linaro.org>2018-05-09 05:23:50 +0200
committerVinod Koul <vkoul@kernel.org>2018-05-09 08:13:17 +0200
commite7f063ae1a31e953bd2460d81697d18408f03641 (patch)
tree54b88a914e42b0453fbee8ad3430b088fb3f7b9a
parentdmaengine: sprd: Fix potential NULL dereference in sprd_dma_probe() (diff)
downloadlinux-e7f063ae1a31e953bd2460d81697d18408f03641.tar.xz
linux-e7f063ae1a31e953bd2460d81697d18408f03641.zip
dmaengine: sprd: Use devm_ioremap_resource() to map memory
Instead of checking the return value of platform_get_resource(), we can use devm_ioremap_resource() which has the NULL pointer check and the memory region requesting. Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Vinod Koul <vkoul@kernel.org>
-rw-r--r--drivers/dma/sprd-dma.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index dba7a17dee15..e715d07aa632 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -807,10 +807,7 @@ static int sprd_dma_probe(struct platform_device *pdev)
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -EINVAL;
- sdev->glb_base = devm_ioremap_nocache(&pdev->dev, res->start,
- resource_size(res));
+ sdev->glb_base = devm_ioremap_resource(&pdev->dev, res);
if (!sdev->glb_base)
return -ENOMEM;