From: Thomas Gleixner <tglx@linutronix.de>
To: sasa sasa <sasak.1983@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] IRQ : bug fix in setup_irq
Date: Sat, 19 Jul 2008 00:18:27 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.1.10.0807190013590.4316@apollo.tec.linutronix.de> (raw)
In-Reply-To: <aecf5e530807180321v529c95e1k91fbcffe246a0a75@mail.gmail.com>
On Fri, 18 Jul 2008, sasa sasa wrote:
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 1f31422..ca92f97 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -339,6 +339,7 @@ int setup_irq(unsigned int irq, struct irqaction *new)
> desc->status |= IRQ_NO_BALANCING;
>
> if (!shared) {
> + int trigger_type = 0;
No need to initialize to zero.
> irq_chip_set_defaults(desc->chip);
>
> #if defined(CONFIG_IRQ_PER_CPU)
> @@ -346,11 +347,22 @@ int setup_irq(unsigned int irq, struct irqaction *new)
> desc->status |= IRQ_PER_CPU;
> #endif
>
> + trigger_type = new->flags & IRQF_TRIGGER_MASK;
> +
> /* Setup the type (level, edge polarity) if configured: */
> - if (new->flags & IRQF_TRIGGER_MASK) {
> - if (desc->chip && desc->chip->set_type)
> - desc->chip->set_type(irq,
> - new->flags & IRQF_TRIGGER_MASK);
> + if (trigger_type) {
> + if (desc->chip && desc->chip->set_type) {
> + if ((desc->chip->set_type(irq, trigger_type))) {
> + /* Action handler gets freed but
> + * desc->action also needs to be
> + * set to NULL
> + */
That's not desc->action. That's the end of the desc->action list
> + *p = NULL;
Can we have a printk here, which tells us what went wrong ?
> + spin_unlock_irqrestore(&desc->lock,
> + flags);
> + return -EBUSY;
Please use the already existing error exit via "goto ..." instead
> + }
> + }
> else
> /*
> * IRQF_TRIGGER_* but the PIC does not support
> @@ -571,8 +583,10 @@ int request_irq(unsigned int irq, irq_handler_t handler,
> #endif
>
> retval = setup_irq(irq, action);
> - if (retval)
> + if (retval) {
> + printk(KERN_WARNING"Failed to allocate interrupt %d\n", retval);
> kfree(action);
We dont want to know that the setup function returned -EBUSY. We
rather want to have a printk in the path above.
Thanks,
tglx
next prev parent reply other threads:[~2008-07-18 22:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-18 10:21 sasa sasa
2008-07-18 22:18 ` Thomas Gleixner [this message]
2008-07-22 8:42 sasa sasa
2008-07-22 11:23 ` Uwe Kleine-König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.1.10.0807190013590.4316@apollo.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=sasak.1983@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®