gpiolib: acpi: Simplify error handling in __acpi_find_gpio()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 11 Apr 2024 17:22:30 +0000 (20:22 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 15 Apr 2024 13:12:18 +0000 (16:12 +0300)
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 <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/gpio/gpiolib-acpi.c

index d47b22ac3ecb14643720d0b71330241fe32ed547..fb2e14670b7a0eb236655931aadf50a9a56f7350 100644 (file)
@@ -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;
+                       return desc;
        }
 
        /* 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;
-       }
+       if (!adev || !acpi_can_fallback_to_crs(adev, con_id))
+               return ERR_PTR(-ENOENT);
 
-       return desc;
+       return acpi_get_gpiod_by_index(adev, NULL, idx, info);
 }
 
 struct gpio_desc *acpi_find_gpio(struct fwnode_handle *fwnode,