Skip to content

Commit d8a26a1

Browse files
committed
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 <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 7057fc7 commit d8a26a1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/gpio/gpiolib-acpi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,10 +973,11 @@ struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,
973973
else
974974
desc = acpi_get_gpiod_from_data(fwnode,
975975
propname, idx, &info);
976-
if (!IS_ERR(desc))
977-
break;
978976
if (PTR_ERR(desc) == -EPROBE_DEFER)
979977
return ERR_CAST(desc);
978+
979+
if (!IS_ERR(desc))
980+
break;
980981
}
981982

982983
/* Then from plain _CRS GPIOs */

0 commit comments

Comments
 (0)