}
 }
 
+/*
+ * This descriptor validation needs to be inserted verbatim into each
+ * function taking a descriptor, so we need to use a preprocessor
+ * macro to avoid endless duplication. If the desc is NULL it is an
+ * optional GPIO and calls should just bail out.
+ */
+static int validate_desc(const struct gpio_desc *desc, const char *func)
+{
+       if (!desc)
+               return 0;
+
+       if (IS_ERR(desc)) {
+               pr_warn("%s: invalid GPIO (errorpointer: %pe)\n", func, desc);
+               return PTR_ERR(desc);
+       }
+
+       return 1;
+}
+
+#define VALIDATE_DESC(desc) do { \
+       int __valid = validate_desc(desc, __func__); \
+       if (__valid <= 0) \
+               return __valid; \
+       } while (0)
+
+#define VALIDATE_DESC_VOID(desc) do { \
+       int __valid = validate_desc(desc, __func__); \
+       if (__valid <= 0) \
+               return; \
+       } while (0)
+
 static int gpiochip_get_direction(struct gpio_chip *gc, unsigned int offset)
 {
        int ret;
        return ret;
 }
 
-/*
- * This descriptor validation needs to be inserted verbatim into each
- * function taking a descriptor, so we need to use a preprocessor
- * macro to avoid endless duplication. If the desc is NULL it is an
- * optional GPIO and calls should just bail out.
- */
-static int validate_desc(const struct gpio_desc *desc, const char *func)
-{
-       if (!desc)
-               return 0;
-
-       if (IS_ERR(desc)) {
-               pr_warn("%s: invalid GPIO (errorpointer: %pe)\n", func, desc);
-               return PTR_ERR(desc);
-       }
-
-       return 1;
-}
-
-#define VALIDATE_DESC(desc) do { \
-       int __valid = validate_desc(desc, __func__); \
-       if (__valid <= 0) \
-               return __valid; \
-       } while (0)
-
-#define VALIDATE_DESC_VOID(desc) do { \
-       int __valid = validate_desc(desc, __func__); \
-       if (__valid <= 0) \
-               return; \
-       } while (0)
-
 int gpiod_request(struct gpio_desc *desc, const char *label)
 {
        int ret = -EPROBE_DEFER;