Commit f72401e9 authored by Julia Lawall's avatar Julia Lawall Committed by Wim Van Sebroeck

watchdog: s3c2410_wdt.c: Convert release_resource to release_region/release_mem_region

Request_mem_region should be used with release_mem_region, not
release_resource.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,E;
@@
*x = request_mem_region(...)
... when != release_mem_region(x)
    when != x = E
* release_resource(x);
// </smpl>
Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
Cc: stable <stable@kernel.org>
parent 89078d57
...@@ -402,7 +402,6 @@ static inline void s3c2410wdt_cpufreq_deregister(void) ...@@ -402,7 +402,6 @@ static inline void s3c2410wdt_cpufreq_deregister(void)
static int __devinit s3c2410wdt_probe(struct platform_device *pdev) static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
{ {
struct resource *res;
struct device *dev; struct device *dev;
unsigned int wtcon; unsigned int wtcon;
int started = 0; int started = 0;
...@@ -416,20 +415,19 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev) ...@@ -416,20 +415,19 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
/* get the memory region for the watchdog timer */ /* get the memory region for the watchdog timer */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) { if (wdt_mem == NULL) {
dev_err(dev, "no memory resource specified\n"); dev_err(dev, "no memory resource specified\n");
return -ENOENT; return -ENOENT;
} }
size = resource_size(res); size = resource_size(wdt_mem);
wdt_mem = request_mem_region(res->start, size, pdev->name); if (!request_mem_region(wdt_mem->start, size, pdev->name)) {
if (wdt_mem == NULL) {
dev_err(dev, "failed to get memory region\n"); dev_err(dev, "failed to get memory region\n");
return -EBUSY; return -EBUSY;
} }
wdt_base = ioremap(res->start, size); wdt_base = ioremap(wdt_mem->start, size);
if (wdt_base == NULL) { if (wdt_base == NULL) {
dev_err(dev, "failed to ioremap() region\n"); dev_err(dev, "failed to ioremap() region\n");
ret = -EINVAL; ret = -EINVAL;
...@@ -524,8 +522,8 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev) ...@@ -524,8 +522,8 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
iounmap(wdt_base); iounmap(wdt_base);
err_req: err_req:
release_resource(wdt_mem); release_mem_region(wdt_mem->start, size);
kfree(wdt_mem); wdt_mem = NULL;
return ret; return ret;
} }
...@@ -545,8 +543,7 @@ static int __devexit s3c2410wdt_remove(struct platform_device *dev) ...@@ -545,8 +543,7 @@ static int __devexit s3c2410wdt_remove(struct platform_device *dev)
iounmap(wdt_base); iounmap(wdt_base);
release_resource(wdt_mem); release_mem_region(wdt_mem->start, resource_size(wdt_mem));
kfree(wdt_mem);
wdt_mem = NULL; wdt_mem = NULL;
return 0; return 0;
} }
......
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