From: Guan Xuetao <gxt@mprc.pku.edu.cn>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 7/7] arch/unicore32/kernel/dma.c: ensure arguments to request_irq and free_irq are compatible
Date: Wed, 14 Mar 2012 16:07:24 +0800 [thread overview]
Message-ID: <1331712444.2389.36.camel@epip-laptop> (raw)
In-Reply-To: <alpine.DEB.2.02.1203130921250.1974@localhost6.localdomain6>
On Tue, 2012-03-13 at 09:23 +0100, Julia Lawall wrote:
> On Tue, 13 Mar 2012, Guan Xuetao wrote:
>
> > On Mon, 2012-03-12 at 06:27 +0100, Julia Lawall wrote:
> >> On Mon, 12 Mar 2012, Guan Xuetao wrote:
> >>
> >>> On Sun, 2012-03-11 at 20:36 +0100, Julia Lawall wrote:
> >>>> From: Julia Lawall <Julia.Lawall@lip6.fr>
> >>>>
> >>>> Convert calls to free_irq so that the second argument is the same as the
> >>>> last argument of the corresponding call to request_irq, rather than the
> >>>> second to last. Without this property, free_irq does nothing.
> >>>>
> >>>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> >>>>
> >>>> ---
> >>>> arch/unicore32/kernel/dma.c | 2 +-
> >>>> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/arch/unicore32/kernel/dma.c b/arch/unicore32/kernel/dma.c
> >>>> index ae441bc..c813fec 100644
> >>>> --- a/arch/unicore32/kernel/dma.c
> >>>> +++ b/arch/unicore32/kernel/dma.c
> >>>> @@ -173,7 +173,7 @@ int __init puv3_init_dma(void)
> >>>> ret = request_irq(IRQ_DMAERR, dma_err_handler, 0, "DMAERR", NULL);
> >>>> if (ret) {
> >>>> printk(KERN_CRIT "Can't register IRQ for DMAERR\n");
> >>>> - free_irq(IRQ_DMA, "DMA");
> >>>> + free_irq(IRQ_DMA, NULL);
> >>>> return ret;
> >>>> }
> >>>>
> >>> Yeah, it's an obvious mistake. Thanks.
> >>> Because the dma device is just located inside PKUnity-3 SoC, and
> >>> request_irq() should always return 0, I prefer to remove this free_irq()
> >>> line.
> >>
> >> Remove the whole if test I guess. Is there a nce way to indicate that the
> >> return value is not needed (eg for the benefit of future bug finding
> >> rules)?
> >>
> >> julia
> > In this case, removing the line containing free_irq() is well enough,
> > because IRQ_DMA can work even when IRQ_DMAERR doesn't work. And we need
> > printk and error return value to get potential logical bug information.
>
> I'm not completely sure to understand. The point is that the first
> request_irq can never fail, so we don't need to clean up when the second
> one fails? Because the lack of cleaning up will not cause the first one
> to fail the next time? free_irq removes an action from a list and does a
> module_put. Are these operations both not needed?
>
> thanks,julia
puv3_init_dma() is called ONCE when initializing.
In logical, if request_irq(IRQ_DMAERR, *) failed, free_irq(IRQ_DMA, *)
is unnecessary, and dma device/driver can keep on working.
The patch could be:
ret = request_irq(IRQ_DMAERR, dma_err_handler, 0, "DMAERR", NULL);
if (ret) {
printk(KERN_CRIT "Can't register IRQ for DMAERR\n");
- free_irq(IRQ_DMA, "DMA");
return ret;
}
Thanks and Regards,
Guan Xuetao
next prev parent reply other threads:[~2012-03-14 8:07 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-11 19:36 [PATCH 0/7] " Julia Lawall
2012-03-11 19:36 ` [PATCH 1/7] drivers/video/pvr2fb.c: " Julia Lawall
2012-03-21 18:37 ` Florian Tobias Schandinat
2012-03-11 19:36 ` [PATCH 2/7] drivers/scsi/arm/{cumana_2,eesox,powertec}.c: " Julia Lawall
2012-03-11 19:36 ` [PATCH 3/7] drivers/net/irda/{ali-ircc,via-ircc,w83977af-ir}.c: " Julia Lawall
2012-03-11 19:36 ` [PATCH 4/7] arch/sh/drivers/dma/{dma-g2,dmabrg}.c: " Julia Lawall
2012-03-15 6:14 ` Paul Mundt
2012-03-11 19:36 ` [PATCH 5/7] drivers/atm/eni.c: " Julia Lawall
2012-03-11 20:58 ` Chas Williams (CONTRACTOR)
2012-03-11 21:08 ` Julia Lawall
2012-03-11 21:16 ` Julia Lawall
2012-03-11 22:42 ` David Miller
2012-03-11 19:36 ` [PATCH 6/7] drivers/input/touchscreen/hp680_ts_input.c: " Julia Lawall
2012-03-11 23:06 ` Dmitry Torokhov
2012-03-11 19:36 ` [PATCH 7/7] arch/unicore32/kernel/dma.c: " Julia Lawall
2012-03-12 0:58 ` Guan Xuetao
2012-03-12 5:27 ` Julia Lawall
2012-03-13 7:10 ` Guan Xuetao
2012-03-13 8:23 ` Julia Lawall
2012-03-14 8:07 ` Guan Xuetao [this message]
2012-03-14 8:19 ` Dan Carpenter
2012-03-14 8:42 ` Guan Xuetao
2012-03-14 9:23 ` Julia Lawall
2012-03-15 1:01 ` Guan Xuetao
2012-03-15 6:10 ` Julia Lawall
2012-03-15 8:07 ` walter harms
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=1331712444.2389.36.camel@epip-laptop \
--to=gxt@mprc.pku.edu.cn \
--cc=julia.lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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®