lkml.org 
[lkml]   [2022]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/2] drivers: fwnode: fix fwnode_irq_get_byname()
    On Tue, Oct 25, 2022 at 11:50:59AM +0300, Matti Vaittinen wrote:
    > The fwnode_irq_get_byname() does return 0 upon device-tree IRQ mapping
    > failure. This is contradicting the function documentation and can
    > potentially be a source of errors like:
    >
    > int probe(...) {
    > ...
    >
    > irq = fwnode_irq_get_byname();
    > if (irq <= 0)
    > return irq;
    >
    > ...
    > }
    >
    > Here we do correctly check the return value from fwnode_irq_get_byname()
    > but the driver probe will now return success. (There was already one
    > such user in-tree).
    >
    > Change the fwnode_irq_get_byname() to work as documented and according to
    > the common convention and abd always return a negative errno upon failure.

    ...

    > + ret = fwnode_irq_get(fwnode, index);

    > +

    Redundant blank line and better to use traditional pattern:

    > + if (!ret)
    > + return -EINVAL;
    > +
    > + return ret;

    if (ret)
    return ret;

    /* We treat mapping errors as invalid case */
    return -EINVAL;

    > }

    --
    With Best Regards,
    Andy Shevchenko


    \
     
     \ /
      Last update: 2022-10-25 11:23    [W:3.371 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site