Skip to content

Commit 4cd3ef0

Browse files
committed
gpiolib: acpi: Simplify error handling in __acpi_find_gpio()
Now that we don't perform anything on the GPIO descriptor, we may simplify the error path in newly introduced helper. Do it so. Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent 4fa4c49 commit 4cd3ef0

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/gpio/gpiolib-acpi.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -974,20 +974,14 @@ __acpi_find_gpio(struct fwnode_handle *fwnode, const char *con_id, unsigned int
974974
return ERR_CAST(desc);
975975

976976
if (!IS_ERR(desc))
977-
break;
977+
return desc;
978978
}
979979

980980
/* Then from plain _CRS GPIOs */
981-
if (IS_ERR(desc)) {
982-
if (!adev || !acpi_can_fallback_to_crs(adev, con_id))
983-
return ERR_PTR(-ENOENT);
984-
985-
desc = acpi_get_gpiod_by_index(adev, NULL, idx, info);
986-
if (IS_ERR(desc))
987-
return desc;
988-
}
981+
if (!adev || !acpi_can_fallback_to_crs(adev, con_id))
982+
return ERR_PTR(-ENOENT);
989983

990-
return desc;
984+
return acpi_get_gpiod_by_index(adev, NULL, idx, info);
991985
}
992986

993987
struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,

0 commit comments

Comments
 (0)