pinctrl: spear: Convert to devm_ioremap_resource
authorAxel Lin <axel.lin@ingics.com>
Mon, 26 Aug 2013 00:20:45 +0000 (08:20 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 28 Aug 2013 11:34:18 +0000 (13:34 +0200)
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/spear/pinctrl-spear.c

index 116da0412c4b7af55b36d25663f9f762995c0334..58bf6867aa17b69992aa0038111898526c81d11a 100644 (file)
@@ -367,21 +367,16 @@ int spear_pinctrl_probe(struct platform_device *pdev,
        if (!machdata)
                return -ENODEV;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res)
-               return -EINVAL;
-
        pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL);
        if (!pmx) {
                dev_err(&pdev->dev, "Can't alloc spear_pmx\n");
                return -ENOMEM;
        }
 
-       pmx->vbase = devm_ioremap(&pdev->dev, res->start, resource_size(res));
-       if (!pmx->vbase) {
-               dev_err(&pdev->dev, "Couldn't ioremap at index 0\n");
-               return -ENODEV;
-       }
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       pmx->vbase = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(pmx->vbase))
+               return PTR_ERR(pmx->vbase);
 
        pmx->dev = &pdev->dev;
        pmx->machdata = machdata;