Commit 3ec7a176 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

net: eth: xgene: devm_ioremap() returns NULL on error

devm_ioremap() returns NULL on failure, it doesn't return an ERR_PTR.

Fixes: de7b5b3d ('net: eth: xgene: change APM X-Gene SoC platform ethernet to support ACPI')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarIyappan Subramanian <isubramanian@apm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 78890ed7
...@@ -804,9 +804,9 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) ...@@ -804,9 +804,9 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
return -ENODEV; return -ENODEV;
} }
pdata->base_addr = devm_ioremap(dev, res->start, resource_size(res)); pdata->base_addr = devm_ioremap(dev, res->start, resource_size(res));
if (IS_ERR(pdata->base_addr)) { if (!pdata->base_addr) {
dev_err(dev, "Unable to retrieve ENET Port CSR region\n"); dev_err(dev, "Unable to retrieve ENET Port CSR region\n");
return PTR_ERR(pdata->base_addr); return -ENOMEM;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, RES_RING_CSR); res = platform_get_resource(pdev, IORESOURCE_MEM, RES_RING_CSR);
...@@ -816,9 +816,9 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) ...@@ -816,9 +816,9 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
} }
pdata->ring_csr_addr = devm_ioremap(dev, res->start, pdata->ring_csr_addr = devm_ioremap(dev, res->start,
resource_size(res)); resource_size(res));
if (IS_ERR(pdata->ring_csr_addr)) { if (!pdata->ring_csr_addr) {
dev_err(dev, "Unable to retrieve ENET Ring CSR region\n"); dev_err(dev, "Unable to retrieve ENET Ring CSR region\n");
return PTR_ERR(pdata->ring_csr_addr); return -ENOMEM;
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, RES_RING_CMD); res = platform_get_resource(pdev, IORESOURCE_MEM, RES_RING_CMD);
...@@ -828,9 +828,9 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) ...@@ -828,9 +828,9 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
} }
pdata->ring_cmd_addr = devm_ioremap(dev, res->start, pdata->ring_cmd_addr = devm_ioremap(dev, res->start,
resource_size(res)); resource_size(res));
if (IS_ERR(pdata->ring_cmd_addr)) { if (!pdata->ring_cmd_addr) {
dev_err(dev, "Unable to retrieve ENET Ring command region\n"); dev_err(dev, "Unable to retrieve ENET Ring command region\n");
return PTR_ERR(pdata->ring_cmd_addr); return -ENOMEM;
} }
ret = platform_get_irq(pdev, 0); ret = platform_get_irq(pdev, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment