diff mbox

[2/2] arch/powerpc/platforms/85xx: Add local_irq_restore in error handling code

Message ID Pine.LNX.4.64.0812212154240.3635@ask.diku.dk (mailing list archive)
State Accepted, archived
Commit 870029a682d468585a80ce782871f3f220cfef0f
Headers show

Commit Message

Julia Lawall Dec. 21, 2008, 8:54 p.m. UTC
From: Julia Lawall <julia@diku.dk>

There is a call to local_irq_restore in the normal exit case, so it would
seem that there should be one on an error return as well.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression l;
expression E,E1,E2;
@@

local_irq_save(l);
... when != local_irq_restore(l)
    when != spin_unlock_irqrestore(E,l)
    when any
    when strict
(
if (...) { ... when != local_irq_restore(l)
               when != spin_unlock_irqrestore(E1,l)
+   local_irq_restore(l);
    return ...;
}
|
if (...)
+   {local_irq_restore(l);
    return ...;
+   }
|
spin_unlock_irqrestore(E2,l);
|
local_irq_restore(l);
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 arch/powerpc/platforms/85xx/smp.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Kumar Gala Dec. 30, 2008, 6:11 p.m. UTC | #1
On Dec 21, 2008, at 2:54 PM, Julia Lawall wrote:

> From: Julia Lawall <julia@diku.dk>
>
> There is a call to local_irq_restore in the normal exit case, so it  
> would
> seem that there should be one on an error return as well.
>
> The semantic patch that makes this change is as follows:
> (http://www.emn.fr/x-info/coccinelle/)
>
> // <smpl>
> @@
> expression l;
> expression E,E1,E2;
> @@
>
> local_irq_save(l);
> ... when != local_irq_restore(l)
>    when != spin_unlock_irqrestore(E,l)
>    when any
>    when strict
> (
> if (...) { ... when != local_irq_restore(l)
>               when != spin_unlock_irqrestore(E1,l)
> +   local_irq_restore(l);
>    return ...;
> }
> |
> if (...)
> +   {local_irq_restore(l);
>    return ...;
> +   }
> |
> spin_unlock_irqrestore(E2,l);
> |
> local_irq_restore(l);
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
>
> ---
> arch/powerpc/platforms/85xx/smp.c |    1 +
> 1 file changed, 1 insertion(+)

applied.

- k
diff mbox

Patch

diff -u -p a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -58,6 +58,7 @@  smp_85xx_kick_cpu(int nr)
 
 	if (cpu_rel_addr == NULL) {
 		printk(KERN_ERR "No cpu-release-addr for cpu %d\n", nr);
+		local_irq_restore(flags);
 		return;
 	}