From: Andy Shevchenko Date: Wed, 16 Apr 2025 09:55:15 +0000 (+0300) Subject: gpiolib: Reuse return variable in gpiod_to_irq() X-Git-Tag: v6.16-rc1~169^2~54 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=7cc868831b98eb10e8ae50a8e5a9f04674d1a2ab;p=linux-block.git gpiolib: Reuse return variable in gpiod_to_irq() There are two variables for the same used in the gpiod_to_irq(). Replace the second by reusing the function top-level one. While at it, refactor the branch to have less lines of code. Reviewed-by: Linus Walleij Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20250416095645.2027695-8-andriy.shevchenko@linux.intel.com Signed-off-by: Bartosz Golaszewski --- diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 8a47d861d836..3243ef3fc7d8 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -3994,13 +3994,12 @@ int gpiod_to_irq(const struct gpio_desc *desc) offset = gpio_chip_hwgpio(desc); if (gc->to_irq) { - int retirq = gc->to_irq(gc, offset); + ret = gc->to_irq(gc, offset); + if (ret) + return ret; /* Zero means NO_IRQ */ - if (!retirq) - return -ENXIO; - - return retirq; + return -ENXIO; } #ifdef CONFIG_GPIOLIB_IRQCHIP if (gc->irq.chip) {