All of lore.kernel.org
 help / color / mirror / Atom feed
* "Trying to free already-free IRQ 9", but it wasn't freed by me
@ 2012-02-07 14:15 nils.stec
  2012-02-07 15:03 ` mayur nande
  0 siblings, 1 reply; 2+ messages in thread
From: nils.stec @ 2012-02-07 14:15 UTC (permalink / raw)
  To: kernelnewbies

Hi,

atm I'm writing a kernel module for an embedded ARM device.
This module uses IRQ9.

If i remove the module, the kernel tells me that:

------------[ cut here ]------------
WARNING: at kernel/irq/manage.c:858 __free_irq+0x84/0x154()
Trying to free already-free IRQ 9
Modules linked in: adc_demo_irq(P-) g_ether pegasus mii
[<c0028794>] (unwind_backtrace+0x0/0xd0) from [<c003b504>] 
(warn_slowpath_common+0x48/0x60)
[<c003b504>] (warn_slowpath_common+0x48/0x60) from [<c003b554>] 
(warn_slowpath_fmt+0x24/0x30)
[<c003b554>] (warn_slowpath_fmt+0x24/0x30) from [<c005fa00>] 
(__free_irq+0x84/0x154)
[<c005fa00>] (__free_irq+0x84/0x154) from [<c005fb0c>] (free_irq+0x3c/0x5c)
[<c005fb0c>] (free_irq+0x3c/0x5c) from [<bf01e18c>] 
(cleanup_module+0x4c/0x60 [adc_demo_irq])
[<bf01e18c>] (cleanup_module+0x4c/0x60 [adc_demo_irq]) from [<c005b898>] 
(sys_delete_module+0x1c4/0x238)
[<c005b898>] (sys_delete_module+0x1c4/0x238) from [<c0022dc0>] 
(ret_fast_syscall+0x0/0x28)
---[ end trace 60d7a16d878ac0b3 ]---
adc testing module removed
------------[ cut here ]------------

The message "adc testing module removed" comes from my module *after* 
free_irq() via printk, so the module exit routine works till the end.

This is my code (only the IRQ related part):

irqreturn_t adc_irq_handler(int irq, void *dev_id) {

     ... do someting ...

     return IRQ_HANDLED;
}

int init_module(void) {
     int32_t retval;
     ...
     retval = request_irq(ADC_IRQ, adc_irq_handler, IRQF_SHARED, 
"lpc313x adc irq", (void *)(adc_irq_handler));
     ...
     return retval;
}

void cleanup_module(void) {
     ...
     free_irq(ADC_IRQ, NULL);        /* remove interrupt handler */
     ...
     return;
}


I hope anyone of you can help me with that problem. If you need more 
information, i'll send it

Greetings,
Nils
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120207/fb5e0d4c/attachment-0001.html 

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

* "Trying to free already-free IRQ 9", but it wasn't freed by me
  2012-02-07 14:15 "Trying to free already-free IRQ 9", but it wasn't freed by me nils.stec
@ 2012-02-07 15:03 ` mayur nande
  0 siblings, 0 replies; 2+ messages in thread
From: mayur nande @ 2012-02-07 15:03 UTC (permalink / raw)
  To: kernelnewbies

Hi Nils,

>>void cleanup_module(void) {
 >>   ...
  >>  free_irq(ADC_IRQ, NULL);        /* remove interrupt handler */
  >>  ...
  >>   return;
>>}

You should not pass NULL here. It should be the unique cookie that you
passed in request_irq (adc_irq_handler in your case) since you have used
IRQF_SHARED which means you want to share your interrupt line. Also check
whether you really want to share your interrupt line and also if you want
to use "(void *)(adc_irq_handler)" as the unique identification.

HTH!

Regards
Mayur

On Tue, Feb 7, 2012 at 7:45 PM, nils.stec <nils.stec@googlemail.com> wrote:

>  Hi,
>
> atm I'm writing a kernel module for an embedded ARM device.
> This module uses IRQ9.
>
> If i remove the module, the kernel tells me that:
>
> ------------[ cut here ]------------
> WARNING: at kernel/irq/manage.c:858 __free_irq+0x84/0x154()
> Trying to free already-free IRQ 9
> Modules linked in: adc_demo_irq(P-) g_ether pegasus mii
> [<c0028794>] (unwind_backtrace+0x0/0xd0) from [<c003b504>]
> (warn_slowpath_common+0x48/0x60)
> [<c003b504>] (warn_slowpath_common+0x48/0x60) from [<c003b554>]
> (warn_slowpath_fmt+0x24/0x30)
> [<c003b554>] (warn_slowpath_fmt+0x24/0x30) from [<c005fa00>]
> (__free_irq+0x84/0x154)
> [<c005fa00>] (__free_irq+0x84/0x154) from [<c005fb0c>]
> (free_irq+0x3c/0x5c)
> [<c005fb0c>] (free_irq+0x3c/0x5c) from [<bf01e18c>]
> (cleanup_module+0x4c/0x60 [adc_demo_irq])
> [<bf01e18c>] (cleanup_module+0x4c/0x60 [adc_demo_irq]) from [<c005b898>]
> (sys_delete_module+0x1c4/0x238)
> [<c005b898>] (sys_delete_module+0x1c4/0x238) from [<c0022dc0>]
> (ret_fast_syscall+0x0/0x28)
> ---[ end trace 60d7a16d878ac0b3 ]---
> adc testing module removed
> ------------[ cut here ]------------
>
> The message "adc testing module removed" comes from my module **after**free_irq() via printk, so the module exit routine works till the end.
>
> This is my code (only the IRQ related part):
>
> irqreturn_t adc_irq_handler(int irq, void *dev_id) {
>
>     ... do someting ...
>
>     return IRQ_HANDLED;
> }
>
> int init_module(void) {
>     int32_t retval;
>     ...
>     retval = request_irq(ADC_IRQ, adc_irq_handler, IRQF_SHARED, "lpc313x
> adc irq", (void *)(adc_irq_handler));
>     ...
>     return retval;
> }
>
> void cleanup_module(void) {
>     ...
>     free_irq(ADC_IRQ, NULL);        /* remove interrupt handler */
>     ...
>     return;
> }
>
>
> I hope anyone of you can help me with that problem. If you need more
> information, i'll send it
>
> Greetings,
> Nils
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120207/79cf9412/attachment.html 

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

end of thread, other threads:[~2012-02-07 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-07 14:15 "Trying to free already-free IRQ 9", but it wasn't freed by me nils.stec
2012-02-07 15:03 ` mayur nande

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.