Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'regulator-fix-v6.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown:
"This is more changes than I'd like this late although the diffstat is
still fairly small, I kept on holding off as new fixes came in to give
things time to soak in -next but should probably have tagged and sent
an additional pull request earlier.

There's some relatively large fixes to the twl6030 driver to fix
issues with the TWL6032 variant which resulted from some work on the
core TWL6030 driver, a couple of fixes for error handling paths
(mostly in the core), and a nice stability fix for the sgl51000 driver
that's been pulled out of a BSP"

* tag 'regulator-fix-v6.1-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
regulator: twl6030: fix get status of twl6032 regulators
regulator: twl6030: re-add TWL6032_SUBCLASS
regulator: slg51000: Wait after asserting CS pin
regulator: core: fix UAF in destroy_regulator()
regulator: rt5759: fix OOB in validate_desc()
regulator: core: fix kobject release warning and memory leak in regulator_register()

+22 -6
+6 -2
drivers/regulator/core.c
··· 5154 5154 { 5155 5155 struct regulator_dev *rdev = dev_get_drvdata(dev); 5156 5156 5157 + debugfs_remove_recursive(rdev->debugfs); 5157 5158 kfree(rdev->constraints); 5158 5159 of_node_put(rdev->dev.of_node); 5159 5160 kfree(rdev); ··· 5645 5644 mutex_lock(&regulator_list_mutex); 5646 5645 regulator_ena_gpio_free(rdev); 5647 5646 mutex_unlock(&regulator_list_mutex); 5647 + put_device(&rdev->dev); 5648 + rdev = NULL; 5648 5649 clean: 5649 5650 if (dangling_of_gpiod) 5650 5651 gpiod_put(config->ena_gpiod); 5652 + if (rdev && rdev->dev.of_node) 5653 + of_node_put(rdev->dev.of_node); 5654 + kfree(rdev); 5651 5655 kfree(config); 5652 - put_device(&rdev->dev); 5653 5656 rinse: 5654 5657 if (dangling_cfg_gpiod) 5655 5658 gpiod_put(cfg->ena_gpiod); ··· 5682 5677 5683 5678 mutex_lock(&regulator_list_mutex); 5684 5679 5685 - debugfs_remove_recursive(rdev->debugfs); 5686 5680 WARN_ON(rdev->open_count); 5687 5681 regulator_remove_coupling(rdev); 5688 5682 unset_regulator_supplies(rdev);
+1
drivers/regulator/rt5759-regulator.c
··· 243 243 if (priv->chip_type == CHIP_TYPE_RT5759A) 244 244 reg_desc->uV_step = RT5759A_STEP_UV; 245 245 246 + memset(&reg_cfg, 0, sizeof(reg_cfg)); 246 247 reg_cfg.dev = priv->dev; 247 248 reg_cfg.of_node = np; 248 249 reg_cfg.init_data = of_get_regulator_init_data(priv->dev, np, reg_desc);
+2
drivers/regulator/slg51000-regulator.c
··· 457 457 chip->cs_gpiod = cs_gpiod; 458 458 } 459 459 460 + usleep_range(10000, 11000); 461 + 460 462 i2c_set_clientdata(client, chip); 461 463 chip->chip_irq = client->irq; 462 464 chip->dev = dev;
+13 -4
drivers/regulator/twl6030-regulator.c
··· 67 67 #define TWL6030_CFG_STATE_SLEEP 0x03 68 68 #define TWL6030_CFG_STATE_GRP_SHIFT 5 69 69 #define TWL6030_CFG_STATE_APP_SHIFT 2 70 + #define TWL6030_CFG_STATE_MASK 0x03 70 71 #define TWL6030_CFG_STATE_APP_MASK (0x03 << TWL6030_CFG_STATE_APP_SHIFT) 71 72 #define TWL6030_CFG_STATE_APP(v) (((v) & TWL6030_CFG_STATE_APP_MASK) >>\ 72 73 TWL6030_CFG_STATE_APP_SHIFT) ··· 129 128 if (grp < 0) 130 129 return grp; 131 130 grp &= P1_GRP_6030; 131 + val = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_STATE); 132 + val = TWL6030_CFG_STATE_APP(val); 132 133 } else { 134 + val = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_STATE); 135 + val &= TWL6030_CFG_STATE_MASK; 133 136 grp = 1; 134 137 } 135 - 136 - val = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_STATE); 137 - val = TWL6030_CFG_STATE_APP(val); 138 138 139 139 return grp && (val == TWL6030_CFG_STATE_ON); 140 140 } ··· 189 187 190 188 val = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_STATE); 191 189 192 - switch (TWL6030_CFG_STATE_APP(val)) { 190 + if (info->features & TWL6032_SUBCLASS) 191 + val &= TWL6030_CFG_STATE_MASK; 192 + else 193 + val = TWL6030_CFG_STATE_APP(val); 194 + 195 + switch (val) { 193 196 case TWL6030_CFG_STATE_ON: 194 197 return REGULATOR_STATUS_NORMAL; 195 198 ··· 537 530 #define TWL6032_ADJUSTABLE_LDO(label, offset) \ 538 531 static const struct twlreg_info TWL6032_INFO_##label = { \ 539 532 .base = offset, \ 533 + .features = TWL6032_SUBCLASS, \ 540 534 .desc = { \ 541 535 .name = #label, \ 542 536 .id = TWL6032_REG_##label, \ ··· 570 562 #define TWL6032_ADJUSTABLE_SMPS(label, offset) \ 571 563 static const struct twlreg_info TWLSMPS_INFO_##label = { \ 572 564 .base = offset, \ 565 + .features = TWL6032_SUBCLASS, \ 573 566 .desc = { \ 574 567 .name = #label, \ 575 568 .id = TWL6032_REG_##label, \