Skip to content

Commit

Permalink
drivers/video: Convert release_resource to release_mem_region
Browse files Browse the repository at this point in the history
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>
@s exists@
expression e1,e2,e3,e4,e;
@@

*e4 = request_mem_region(e1,e2,e3)
... when != e4 = e
*release_resource(e4);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Julia Lawall authored and Paul Mundt committed May 24, 2011
1 parent 94cd1ae commit 683e7cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions drivers/video/s3c-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1449,8 +1449,7 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
iounmap(sfb->regs);

err_req_region:
release_resource(sfb->regs_res);
kfree(sfb->regs_res);
release_mem_region(sfb->regs_res->start, resource_size(sfb->regs_res));

err_clk:
clk_disable(sfb->bus_clk);
Expand Down Expand Up @@ -1486,8 +1485,7 @@ static int __devexit s3c_fb_remove(struct platform_device *pdev)
clk_disable(sfb->bus_clk);
clk_put(sfb->bus_clk);

release_resource(sfb->regs_res);
kfree(sfb->regs_res);
release_mem_region(sfb->regs_res->start, resource_size(sfb->regs_res));

kfree(sfb);

Expand Down
6 changes: 2 additions & 4 deletions drivers/video/sh7760fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,7 @@ static int __devinit sh7760fb_probe(struct platform_device *pdev)
free_irq(par->irq, &par->vsync);
iounmap(par->base);
out_res:
release_resource(par->ioarea);
kfree(par->ioarea);
release_mem_region(res->start, resource_size(res));
out_fb:
framebuffer_release(info);
return ret;
Expand All @@ -570,8 +569,7 @@ static int __devexit sh7760fb_remove(struct platform_device *dev)
if (par->irq >= 0)
free_irq(par->irq, par);
iounmap(par->base);
release_resource(par->ioarea);
kfree(par->ioarea);
release_mem_region(par->ioarea->start, resource_size(par->ioarea));
framebuffer_release(info);
platform_set_drvdata(dev, NULL);

Expand Down

0 comments on commit 683e7cd

Please sign in to comment.