lkml.org 
[lkml]   [2023]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v1 1/1] gpiolib: Remove duplicative check in gpiod_find_and_request()
    Date
    The gpiod_find_by_fwnode() already checks for NULL and returns
    correct error code in case fwnode is invalid. Drop the respective
    check and assignment in the gpiod_find_and_request().

    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    ---
    drivers/gpio/gpiolib.c | 7 ++-----
    1 file changed, 2 insertions(+), 5 deletions(-)

    diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
    index 8ecfe3afde1e..333ccd44e2b2 100644
    --- a/drivers/gpio/gpiolib.c
    +++ b/drivers/gpio/gpiolib.c
    @@ -3927,13 +3927,10 @@ static struct gpio_desc *gpiod_find_and_request(struct device *consumer,
    bool platform_lookup_allowed)
    {
    unsigned long lookupflags = GPIO_LOOKUP_FLAGS_DEFAULT;
    - struct gpio_desc *desc = ERR_PTR(-ENOENT);
    + struct gpio_desc *desc;
    int ret;

    - if (!IS_ERR_OR_NULL(fwnode))
    - desc = gpiod_find_by_fwnode(fwnode, consumer, con_id, idx,
    - &flags, &lookupflags);
    -
    + desc = gpiod_find_by_fwnode(fwnode, consumer, con_id, idx, &flags, &lookupflags);
    if (gpiod_not_found(desc) && platform_lookup_allowed) {
    /*
    * Either we are not using DT or ACPI, or their lookup did not
    --
    2.39.1
    \
     
     \ /
      Last update: 2023-03-27 00:52    [W:4.100 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site