@@ -2648,17 +2648,18 @@ static int bcm_enetsw_probe(struct platform_device *pdev)
struct bcm_enet_priv *priv;
struct net_device *dev;
struct bcm63xx_enetsw_platform_data *pd;
- struct resource *res_mem;
int ret, irq_rx, irq_tx;
if (!bcm_enet_shared_base[0])
return -EPROBE_DEFER;
- res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq_rx = platform_get_irq(pdev, 0);
+ if (irq_rx < 0)
+ return irq_rx;
+
irq_tx = platform_get_irq(pdev, 1);
- if (!res_mem || irq_rx < 0)
- return -ENODEV;
+ if (irq_tx < 0)
+ return irq_tx;
dev = alloc_etherdev(sizeof(*priv));
if (!dev)
@@ -2690,7 +2691,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev)
if (ret)
goto out;
- priv->base = devm_ioremap_resource(&pdev->dev, res_mem);
+ priv->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->base)) {
ret = PTR_ERR(priv->base);
goto out;
Use devm_platform_ioremap_resource() to simplify code. Signed-off-by: Yangtao Li <frank.li@vivo.com> --- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)