diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 8f1ac023bb033b79f5b4a49df78f77b7597fa0a5..b1bcd4ba47444e0f36c1bc4f9d8a2ff446ba5882 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -2862,8 +2862,8 @@ static int bcm_enet_shared_probe(struct platform_device *pdev)
 	for (i = 0; i < 3; i++) {
 		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
 		p[i] = devm_ioremap_resource(&pdev->dev, res);
-		if (!p[i])
-			return -ENOMEM;
+		if (IS_ERR(p[i]))
+			return PTR_ERR(p[i]);
 	}
 
 	memcpy(bcm_enet_shared_base, p, sizeof(bcm_enet_shared_base));