From: Andy Shevchenko Date: Wed, 10 Apr 2024 20:21:47 +0000 (+0300) Subject: gpiolib: acpi: Check for errors first in acpi_find_gpio() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d8a26a18d971cd52a9b253aa2cff7dcb20187711;p=linux.git 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 Signed-off-by: Andy Shevchenko --- diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index f596edf89451c..c2a33beeec50f 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 */