summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2024-04-10 23:21:47 +0300
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2024-04-11 16:37:08 +0300
commitd8a26a18d971cd52a9b253aa2cff7dcb20187711 (patch)
treedc528265b7af148494098bfd84a56deb666e3189 /drivers/gpio
parent7057fc74d6886471b7dcb4faadf56bd71e28296d (diff)
gpiolib: acpi: Check for errors first in acpi_find_gpio()
It's better to parse the code when the usual pattern is being used, i.e. checking for error condition first. There is no functional or code generation change (tested in LLVM). Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib-acpi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index f596edf89451..c2a33beeec50 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -973,10 +973,11 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
else
desc = acpi_get_gpiod_from_data(fwnode,
propname, idx, &info);
- if (!IS_ERR(desc))
- break;
if (PTR_ERR(desc) == -EPROBE_DEFER)
return ERR_CAST(desc);
+
+ if (!IS_ERR(desc))
+ break;
}
/* Then from plain _CRS GPIOs */