lkml.org 
[lkml]   [2012]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 7/7] arch/unicore32/kernel/dma.c: ensure arguments to request_irq and free_irq are compatible


    Am 15.03.2012 07:10, schrieb Julia Lawall:
    >
    >
    > On Thu, 15 Mar 2012, Guan Xuetao wrote:
    >
    >> On Wed, 2012-03-14 at 10:23 +0100, Julia Lawall wrote:
    >>>
    >>> On Wed, 14 Mar 2012, Guan Xuetao wrote:
    >>>
    >>>> On Wed, 2012-03-14 at 11:19 +0300, Dan Carpenter wrote:
    >>>>> On Wed, Mar 14, 2012 at 04:07:24PM +0800, Guan Xuetao wrote:
    >>>>>> 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;
    >>>>>> }
    >>>>>
    >>>>> It seems like you should remove the error return as well?
    >>>>>
    >>>>> regards,
    >>>>> dan carpenter
    >>>>>
    >>>> The error return value will only generate an extra warning message, and
    >>>> have no side-effect.
    >>>
    >>> The whole thing seems a little strange. I guess your point is that the
    >>> call site never looks at the return value? Wouldn't it be better to
    >>> make
    >>> there be no return value in that case? If there is a return value, some
    >>> calling context in the future might take that into account and then the
    >>> lack of a free_irq would be a memory leak. Also if the first
    >>> request_irq
    >>> can never fail, perhaps that should be made explicit by not testing the
    >>> return value?
    >>>
    >>> julia
    >> This function is an init_call, not a probe function, and it is only
    >> called ONCE.
    >> The dma device here has two interrupts, one IRQ_DMA, another IRQ_DMAERR.
    >> And the device could work without IRQ_DMAERR.
    >> The return value should indicate whether there is something wrong during
    >> initialization, so the function needs return errno when any request_irq
    >> is failed.
    >> For the first request_irq, some code has prepared its resources before
    >> this call, so I suppose it successful. However, the return value must be
    >> tested.
    >
    > OK, thank you for the explanation. I will change the patch.
    >

    hi Julia,
    would you mind to add the explaination to the code ? there is a good chance
    that someone will find the same problem again.

    re,
    wh


    \
     
     \ /
      Last update: 2012-03-15 09:09    [W:3.173 / U:0.472 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site