Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+3 -2
+3 -2
drivers/gpio/gpiolib-acpi.c
··· 973 973 else 974 974 desc = acpi_get_gpiod_from_data(fwnode, 975 975 propname, idx, &info); 976 - if (!IS_ERR(desc)) 977 - break; 978 976 if (PTR_ERR(desc) == -EPROBE_DEFER) 979 977 return ERR_CAST(desc); 978 + 979 + if (!IS_ERR(desc)) 980 + break; 980 981 } 981 982 982 983 /* Then from plain _CRS GPIOs */