mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] arch/arm/plat-mxc: Add local_irq_restore in error handling code
@ 2008-12-21 20:54 Julia Lawall
  2008-12-21 22:27 ` Sascha Hauer
  2008-12-22 16:33 ` Russell King - ARM Linux
  0 siblings, 2 replies; 3+ messages in thread
From: Julia Lawall @ 2008-12-21 20:54 UTC (permalink / raw)
  To: kernel, linux-arm-kernel, linux-kernel, kernel-janitors

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/arm/plat-mxc/dma-mx1-mx2.c |    1 +
 1 file changed, 1 insertion(+)

diff -u -p a/arch/arm/plat-mxc/dma-mx1-mx2.c b/arch/arm/plat-mxc/dma-mx1-mx2.c
--- a/arch/arm/plat-mxc/dma-mx1-mx2.c
+++ b/arch/arm/plat-mxc/dma-mx1-mx2.c
@@ -698,6 +698,7 @@ int imx_dma_request(int channel, const c
 	if (ret) {
 		printk(KERN_CRIT "Can't register IRQ %d for DMA channel %d\n",
 				MXC_INT_DMACH0 + channel, channel);
+		local_irq_restore(flags);
 		return ret;
 	}
 	init_timer(&imxdma->watchdog);

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

* Re: [PATCH 1/2] arch/arm/plat-mxc: Add local_irq_restore in error handling code
  2008-12-21 20:54 [PATCH 1/2] arch/arm/plat-mxc: Add local_irq_restore in error handling code Julia Lawall
@ 2008-12-21 22:27 ` Sascha Hauer
  2008-12-22 16:33 ` Russell King - ARM Linux
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2008-12-21 22:27 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel, linux-arm-kernel, linux-kernel, kernel-janitors

Hi,

On Sun, Dec 21, 2008 at 09:54:23PM +0100, 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.

Yes, that's correct. Thanks for the patch. A fix for this is already
scheduled upstream though.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH 1/2] arch/arm/plat-mxc: Add local_irq_restore in error handling code
  2008-12-21 20:54 [PATCH 1/2] arch/arm/plat-mxc: Add local_irq_restore in error handling code Julia Lawall
  2008-12-21 22:27 ` Sascha Hauer
@ 2008-12-22 16:33 ` Russell King - ARM Linux
  1 sibling, 0 replies; 3+ messages in thread
From: Russell King - ARM Linux @ 2008-12-22 16:33 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel, linux-arm-kernel, linux-kernel, kernel-janitors

On Sun, Dec 21, 2008 at 09:54:23PM +0100, Julia Lawall wrote:
> 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.

Please check what's queued up for the next merge; a similar change is
already merged as part of a larger patch.  (which is more correct
since it calls local_irq_restore before the printk.)

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

end of thread, other threads:[~2008-12-22 16:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-21 20:54 [PATCH 1/2] arch/arm/plat-mxc: Add local_irq_restore in error handling code Julia Lawall
2008-12-21 22:27 ` Sascha Hauer
2008-12-22 16:33 ` Russell King - ARM Linux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®