]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - drivers/regulator/core.c
staging: gdm724x: check for overflow in gdm_lte_netif_rx()
[mirror_ubuntu-hirsute-kernel.git] / drivers / regulator / core.c
index 67a768fe5b2a308eee0a88f267a192e99a68dd73..1818fbd640b9acfe0acfbd36d5c55e0b56edc686 100644 (file)
@@ -1422,6 +1422,12 @@ static int set_machine_constraints(struct regulator_dev *rdev)
         * and we have control then make sure it is enabled.
         */
        if (rdev->constraints->always_on || rdev->constraints->boot_on) {
+               /* If we want to enable this regulator, make sure that we know
+                * the supplying regulator.
+                */
+               if (rdev->supply_name && !rdev->supply)
+                       return -EPROBE_DEFER;
+
                if (rdev->supply) {
                        ret = regulator_enable(rdev->supply);
                        if (ret < 0) {
@@ -1617,7 +1623,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
                                          const char *supply_name)
 {
        struct regulator *regulator;
-       int err;
+       int err = 0;
 
        if (dev) {
                char buf[REG_STR_SIZE];
@@ -1663,8 +1669,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
                }
        }
 
-       regulator->debugfs = debugfs_create_dir(supply_name,
-                                               rdev->debugfs);
+       if (err != -EEXIST)
+               regulator->debugfs = debugfs_create_dir(supply_name, rdev->debugfs);
        if (!regulator->debugfs) {
                rdev_dbg(rdev, "Failed to create debugfs directory\n");
        } else {