Skip to content

Commit

Permalink
dmaengine: xgene: devm_ioremap() returns NULL on error
Browse files Browse the repository at this point in the history
The code here is checking for IS_ERR() but devm_ioremap() returns NULL
on error and not an error pointer.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
  • Loading branch information
Dan Carpenter authored and Vinod Koul committed Apr 17, 2015
1 parent ed1f041 commit 9c361b1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/dma/xgene-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1895,9 +1895,9 @@ static int xgene_dma_get_resources(struct platform_device *pdev,

pdma->csr_dma = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (IS_ERR(pdma->csr_dma)) {
if (!pdma->csr_dma) {
dev_err(&pdev->dev, "Failed to ioremap csr region");
return PTR_ERR(pdma->csr_dma);
return -ENOMEM;
}

/* Get DMA ring csr region */
Expand All @@ -1909,9 +1909,9 @@ static int xgene_dma_get_resources(struct platform_device *pdev,

pdma->csr_ring = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (IS_ERR(pdma->csr_ring)) {
if (!pdma->csr_ring) {
dev_err(&pdev->dev, "Failed to ioremap ring csr region");
return PTR_ERR(pdma->csr_ring);
return -ENOMEM;
}

/* Get DMA ring cmd csr region */
Expand All @@ -1923,9 +1923,9 @@ static int xgene_dma_get_resources(struct platform_device *pdev,

pdma->csr_ring_cmd = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (IS_ERR(pdma->csr_ring_cmd)) {
if (!pdma->csr_ring_cmd) {
dev_err(&pdev->dev, "Failed to ioremap ring cmd csr region");
return PTR_ERR(pdma->csr_ring_cmd);
return -ENOMEM;
}

/* Get efuse csr region */
Expand All @@ -1937,9 +1937,9 @@ static int xgene_dma_get_resources(struct platform_device *pdev,

pdma->csr_efuse = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (IS_ERR(pdma->csr_efuse)) {
if (!pdma->csr_efuse) {
dev_err(&pdev->dev, "Failed to ioremap efuse csr region");
return PTR_ERR(pdma->csr_efuse);
return -ENOMEM;
}

/* Get DMA error interrupt */
Expand Down

0 comments on commit 9c361b1

Please sign in to comment.