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>
This commit is contained in:
Andy Shevchenko 2024-04-10 23:21:47 +03:00
parent 7057fc74d6
commit d8a26a18d9

View File

@ -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 */