diff mbox series

[v1,2/4] gpiolib: acpi: Simplify error handling in __acpi_find_gpio()

Message ID 20240411172540.4122581-4-andriy.shevchenko@linux.intel.com
State Accepted
Commit 4cd3ef01f60e97422fc9679e4a8d3869188851da
Headers show
Series gpiolib: acpi: Use con_id in acpi_dev_gpio_irq_get_by() | expand

Commit Message

Andy Shevchenko April 11, 2024, 5:22 p.m. UTC
Now that we don't perform anything on the GPIO descriptor,
we may simplify the error path in newly introduced helper.
Do it so.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib-acpi.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index d47b22ac3ecb..fb2e14670b7a 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -974,20 +974,14 @@  __acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, unsigned int
 			return ERR_CAST(desc);
 
 		if (!IS_ERR(desc))
-			break;
-	}
-
-	/* Then from plain _CRS GPIOs */
-	if (IS_ERR(desc)) {
-		if (!adev || !acpi_can_fallback_to_crs(adev, con_id))
-			return ERR_PTR(-ENOENT);
-
-		desc = acpi_get_gpiod_by_index(adev, NULL, idx, info);
-		if (IS_ERR(desc))
 			return desc;
 	}
 
-	return desc;
+	/* Then from plain _CRS GPIOs */
+	if (!adev || !acpi_can_fallback_to_crs(adev, con_id))
+		return ERR_PTR(-ENOENT);
+
+	return acpi_get_gpiod_by_index(adev, NULL, idx, info);
 }
 
 struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,