提交 b0c3af5e 编写于 作者: J Joe Perches 提交者: Jiri Kosina

arm: mach-u300/gpio: Fix mem_region resource size miscalculations

Convert off-by-1 r->end - r->start to resource_size(r)
Signed-off-by: NJoe Perches <joe@perches.com>
Acked-by: NLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 99172a2f
...@@ -581,8 +581,7 @@ static int __init gpio_probe(struct platform_device *pdev) ...@@ -581,8 +581,7 @@ static int __init gpio_probe(struct platform_device *pdev)
if (!memres) if (!memres)
goto err_no_resource; goto err_no_resource;
if (request_mem_region(memres->start, memres->end - memres->start, "GPIO Controller") if (!request_mem_region(memres->start, resource_size(memres), "GPIO Controller")) {
== NULL) {
err = -ENODEV; err = -ENODEV;
goto err_no_ioregion; goto err_no_ioregion;
} }
...@@ -640,7 +639,7 @@ static int __init gpio_probe(struct platform_device *pdev) ...@@ -640,7 +639,7 @@ static int __init gpio_probe(struct platform_device *pdev)
free_irq(gpio_ports[i].irq, &gpio_ports[i]); free_irq(gpio_ports[i].irq, &gpio_ports[i]);
iounmap(virtbase); iounmap(virtbase);
err_no_ioremap: err_no_ioremap:
release_mem_region(memres->start, memres->end - memres->start); release_mem_region(memres->start, resource_size(memres));
err_no_ioregion: err_no_ioregion:
err_no_resource: err_no_resource:
clk_disable(clk); clk_disable(clk);
...@@ -660,7 +659,7 @@ static int __exit gpio_remove(struct platform_device *pdev) ...@@ -660,7 +659,7 @@ static int __exit gpio_remove(struct platform_device *pdev)
for (i = 0 ; i < U300_GPIO_NUM_PORTS; i++) for (i = 0 ; i < U300_GPIO_NUM_PORTS; i++)
free_irq(gpio_ports[i].irq, &gpio_ports[i]); free_irq(gpio_ports[i].irq, &gpio_ports[i]);
iounmap(virtbase); iounmap(virtbase);
release_mem_region(memres->start, memres->end - memres->start); release_mem_region(memres->start, resource_size(memres));
clk_disable(clk); clk_disable(clk);
clk_put(clk); clk_put(clk);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册