From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> Date: Fri, 20 Sep 2019 15:23:39 +0200 Simplify this function implementation by using a known wrapper function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- drivers/net/dsa/vitesse-vsc73xx-platform.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/net/dsa/vitesse-vsc73xx-platform.c b/drivers/net/dsa/vitesse-vsc73xx-platform.c index 0541785f9fee..a3bbf9bd1bf1 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-platform.c +++ b/drivers/net/dsa/vitesse-vsc73xx-platform.c @@ -89,7 +89,6 @@ static int vsc73xx_platform_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct vsc73xx_platform *vsc_platform; - struct resource *res = NULL; int ret; vsc_platform = devm_kzalloc(dev, sizeof(*vsc_platform), GFP_KERNEL); @@ -101,16 +100,7 @@ static int vsc73xx_platform_probe(struct platform_device *pdev) vsc_platform->vsc.dev = dev; vsc_platform->vsc.priv = vsc_platform; vsc_platform->vsc.ops = &vsc73xx_platform_ops; - - /* obtain I/O memory space */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, "cannot obtain I/O memory space\n"); - ret = -ENXIO; - return ret; - } - - vsc_platform->base_addr = devm_ioremap_resource(&pdev->dev, res); + vsc_platform->base_addr = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(vsc_platform->base_addr)) { dev_err(&pdev->dev, "cannot request I/O memory space\n"); ret = -ENXIO; -- 2.23.0