Merge remote-tracking branches 'regulator/fix/axp20x', 'regulator/fix/cpcap' and...
authorMark Brown <broonie@kernel.org>
Mon, 4 Sep 2017 16:45:38 +0000 (17:45 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 4 Sep 2017 16:45:38 +0000 (17:45 +0100)
drivers/regulator/axp20x-regulator.c
drivers/regulator/cpcap-regulator.c
drivers/regulator/of_regulator.c

index e2608fe770b9922c384d38ed86551d05acf09047..f18b36dd57dd44a2f1d94302f6e1492ea6e54f88 100644 (file)
@@ -691,6 +691,9 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
                    (regulators == axp809_regulators && i == AXP809_DC1SW)) {
                        new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
                                                GFP_KERNEL);
+                       if (!new_desc)
+                               return -ENOMEM;
+
                        *new_desc = regulators[i];
                        new_desc->supply_name = dcdc1_name;
                        desc = new_desc;
@@ -700,6 +703,9 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
                    (regulators == axp809_regulators && i == AXP809_DC5LDO)) {
                        new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
                                                GFP_KERNEL);
+                       if (!new_desc)
+                               return -ENOMEM;
+
                        *new_desc = regulators[i];
                        new_desc->supply_name = dcdc5_name;
                        desc = new_desc;
index cc98aceed1c1a10171003ffff42317767c6d6eb4..ce1cab320f6f418b946faa54d7bf2c3853f8f9f3 100644 (file)
@@ -77,6 +77,8 @@
 #define CPCAP_BIT_VAUDIO_MODE0         BIT(1)
 #define CPCAP_BIT_V_AUDIO_EN           BIT(0)
 
+#define CPCAP_BIT_AUDIO_NORMAL_MODE    0x00
+
 /*
  * Off mode configuration bit. Used currently only by SW5 on omap4. There's
  * the following comment in Motorola Linux kernel tree for it:
@@ -217,7 +219,7 @@ static unsigned int cpcap_regulator_get_mode(struct regulator_dev *rdev)
 
        regmap_read(rdev->regmap, rdev->desc->enable_reg, &value);
 
-       if (!(value & CPCAP_BIT_AUDIO_LOW_PWR))
+       if (value & CPCAP_BIT_AUDIO_LOW_PWR)
                return REGULATOR_MODE_STANDBY;
 
        return REGULATOR_MODE_NORMAL;
@@ -230,10 +232,10 @@ static int cpcap_regulator_set_mode(struct regulator_dev *rdev,
 
        switch (mode) {
        case REGULATOR_MODE_NORMAL:
-               value = CPCAP_BIT_AUDIO_LOW_PWR;
+               value = CPCAP_BIT_AUDIO_NORMAL_MODE;
                break;
        case REGULATOR_MODE_STANDBY:
-               value = 0;
+               value = CPCAP_BIT_AUDIO_LOW_PWR;
                break;
        default:
                return -EINVAL;
index 96bf75458da5101ada4321609635933ed715f338..9dd44dd4cdf6d7420ae233017f8e868195c30eff 100644 (file)
@@ -333,7 +333,7 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
                search = of_get_child_by_name(dev->of_node,
                                              desc->regulators_node);
        else
-               search = dev->of_node;
+               search = of_node_get(dev->of_node);
 
        if (!search) {
                dev_dbg(dev, "Failed to find regulator container node '%s'\n",