Commit a8a364bd authored by Jisheng Zhang's avatar Jisheng Zhang Committed by Linus Walleij

pinctrl: mvebu: Convert to use devm_ioremap_resource

The resource mapped by of_iomap() isn't unmapped in error path. This
patch fix the resource leakage by using devm_ioremap_resource() instead
of of_iomap().
Signed-off-by: default avatarJisheng Zhang <jszhang@marvell.com>
Reviewed-by: default avatarEzequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: default avatarJason Cooper <jason@lakedaemon.net>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 03b054e9
...@@ -593,7 +593,7 @@ static int mvebu_pinctrl_build_functions(struct platform_device *pdev, ...@@ -593,7 +593,7 @@ static int mvebu_pinctrl_build_functions(struct platform_device *pdev,
int mvebu_pinctrl_probe(struct platform_device *pdev) int mvebu_pinctrl_probe(struct platform_device *pdev)
{ {
struct mvebu_pinctrl_soc_info *soc = dev_get_platdata(&pdev->dev); struct mvebu_pinctrl_soc_info *soc = dev_get_platdata(&pdev->dev);
struct device_node *np = pdev->dev.of_node; struct resource *res;
struct mvebu_pinctrl *pctl; struct mvebu_pinctrl *pctl;
void __iomem *base; void __iomem *base;
struct pinctrl_pin_desc *pdesc; struct pinctrl_pin_desc *pdesc;
...@@ -605,11 +605,10 @@ int mvebu_pinctrl_probe(struct platform_device *pdev) ...@@ -605,11 +605,10 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
base = of_iomap(np, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!base) { base = devm_ioremap_resource(&pdev->dev, res);
dev_err(&pdev->dev, "unable to get base address\n"); if (IS_ERR(base))
return -ENODEV; return PTR_ERR(base);
}
pctl = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pinctrl), pctl = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pinctrl),
GFP_KERNEL); GFP_KERNEL);
......
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