linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 14/15] drivers/pci/hotplug/ibmphp_ebda.c: add missing iounmap
@ 2012-01-12  9:55 Julia Lawall
  2012-01-27 17:30 ` Jesse Barnes
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2012-01-12  9:55 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: kernel-janitors, linux-pci, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Add missing iounmap in error handling code, in a case where the function
already preforms iounmap on some other execution path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e;
statement S,S1;
int ret;
@@
e = \(ioremap\|ioremap_nocache\)(...)
... when != iounmap(e)
if (<+...e...+>) S
... when any
    when != iounmap(e)
*if (...)
   { ... when != iounmap(e)
     return ...; }
... when any
iounmap(e);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/pci/hotplug/ibmphp_ebda.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c
index 2850e64..714ca5c 100644
--- a/drivers/pci/hotplug/ibmphp_ebda.c
+++ b/drivers/pci/hotplug/ibmphp_ebda.c
@@ -368,8 +368,10 @@ int __init ibmphp_access_ebda (void)
 			debug ("rio blk id: %x\n", blk_id);
 
 			rio_table_ptr = kzalloc(sizeof(struct rio_table_hdr), GFP_KERNEL);
-			if (!rio_table_ptr)
-				return -ENOMEM; 
+			if (!rio_table_ptr) {
+				rc = -ENOMEM;
+				goto out;
+			}
 			rio_table_ptr->ver_num = readb (io_mem + offset);
 			rio_table_ptr->scal_count = readb (io_mem + offset + 1);
 			rio_table_ptr->riodev_count = readb (io_mem + offset + 2);


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 14/15] drivers/pci/hotplug/ibmphp_ebda.c: add missing iounmap
  2012-01-12  9:55 [PATCH 14/15] drivers/pci/hotplug/ibmphp_ebda.c: add missing iounmap Julia Lawall
@ 2012-01-27 17:30 ` Jesse Barnes
  0 siblings, 0 replies; 2+ messages in thread
From: Jesse Barnes @ 2012-01-27 17:30 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, linux-pci, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

On Thu, 12 Jan 2012 10:55:16 +0100
Julia Lawall <Julia.Lawall@lip6.fr> wrote:

> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Add missing iounmap in error handling code, in a case where the function
> already preforms iounmap on some other execution path.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)

Applied to my -next branch, thanks.

-- 
Jesse Barnes, Intel Open Source Technology Center

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-27 17:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-12  9:55 [PATCH 14/15] drivers/pci/hotplug/ibmphp_ebda.c: add missing iounmap Julia Lawall
2012-01-27 17:30 ` Jesse Barnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).