struct regulation_constraints *constraints = &(*init_data)->constraints;
        struct regulator_state *suspend_state;
        struct device_node *suspend_np;
+       unsigned int mode;
        int ret, i;
        u32 pval;
 
 
        if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) {
                if (desc && desc->of_map_mode) {
-                       ret = desc->of_map_mode(pval);
-                       if (ret == -EINVAL)
+                       mode = desc->of_map_mode(pval);
+                       if (mode == REGULATOR_MODE_INVALID)
                                pr_err("%s: invalid mode %u\n", np->name, pval);
                        else
-                               constraints->initial_mode = ret;
+                               constraints->initial_mode = mode;
                } else {
                        pr_warn("%s: mapping for mode %d not defined\n",
                                np->name, pval);
                if (!of_property_read_u32(suspend_np, "regulator-mode",
                                          &pval)) {
                        if (desc && desc->of_map_mode) {
-                               ret = desc->of_map_mode(pval);
-                               if (ret == -EINVAL)
+                               mode = desc->of_map_mode(pval);
+                               if (mode == REGULATOR_MODE_INVALID)
                                        pr_err("%s: invalid mode %u\n",
                                               np->name, pval);
                                else
-                                       suspend_state->mode = ret;
+                                       suspend_state->mode = mode;
                        } else {
                                pr_warn("%s: mapping for mode %d not defined\n",
                                        np->name, pval);
 
  * These modes can be OR'ed together to make up a mask of valid register modes.
  */
 
+#define REGULATOR_MODE_INVALID                 0x0
 #define REGULATOR_MODE_FAST                    0x1
 #define REGULATOR_MODE_NORMAL                  0x2
 #define REGULATOR_MODE_IDLE                    0x4