mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
Merge tag 'regulator-fix-v5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator fixes from Mark Brown: "A small set of fixes for mostly minor issues here, the only real code ones are Wen Yang's fixes for error handling in the core and Christian Marussi's list_voltage() change which is a fix for disruptively bad performance for regulators with continuous voltage control (which are rare)" * tag 'regulator-fix-v5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: rn5t618: fix module aliases regulator: max77650: add of_match table regulator: core: avoid unneeded .list_voltage calls regulator: s5m8767: Fix a warning message regulator: core: fix regulator_register() error paths to properly release rdev regulator: fix use after free issue
This commit is contained in:
@@ -1198,6 +1198,10 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* no need to loop voltages if range is continuous */
|
||||||
|
if (rdev->desc->continuous_voltage_range)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* initial: [cmin..cmax] valid, [min_uV..max_uV] not */
|
/* initial: [cmin..cmax] valid, [min_uV..max_uV] not */
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
int value;
|
int value;
|
||||||
@@ -1938,8 +1942,8 @@ struct regulator *_regulator_get(struct device *dev, const char *id,
|
|||||||
regulator = create_regulator(rdev, dev, id);
|
regulator = create_regulator(rdev, dev, id);
|
||||||
if (regulator == NULL) {
|
if (regulator == NULL) {
|
||||||
regulator = ERR_PTR(-ENOMEM);
|
regulator = ERR_PTR(-ENOMEM);
|
||||||
put_device(&rdev->dev);
|
|
||||||
module_put(rdev->owner);
|
module_put(rdev->owner);
|
||||||
|
put_device(&rdev->dev);
|
||||||
return regulator;
|
return regulator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2063,13 +2067,13 @@ static void _regulator_put(struct regulator *regulator)
|
|||||||
|
|
||||||
rdev->open_count--;
|
rdev->open_count--;
|
||||||
rdev->exclusive = 0;
|
rdev->exclusive = 0;
|
||||||
put_device(&rdev->dev);
|
|
||||||
regulator_unlock(rdev);
|
regulator_unlock(rdev);
|
||||||
|
|
||||||
kfree_const(regulator->supply_name);
|
kfree_const(regulator->supply_name);
|
||||||
kfree(regulator);
|
kfree(regulator);
|
||||||
|
|
||||||
module_put(rdev->owner);
|
module_put(rdev->owner);
|
||||||
|
put_device(&rdev->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -5002,6 +5006,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
|
|||||||
struct regulator_dev *rdev;
|
struct regulator_dev *rdev;
|
||||||
bool dangling_cfg_gpiod = false;
|
bool dangling_cfg_gpiod = false;
|
||||||
bool dangling_of_gpiod = false;
|
bool dangling_of_gpiod = false;
|
||||||
|
bool reg_device_fail = false;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
@@ -5187,7 +5192,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
|
|||||||
dev_set_drvdata(&rdev->dev, rdev);
|
dev_set_drvdata(&rdev->dev, rdev);
|
||||||
ret = device_register(&rdev->dev);
|
ret = device_register(&rdev->dev);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
put_device(&rdev->dev);
|
reg_device_fail = true;
|
||||||
goto unset_supplies;
|
goto unset_supplies;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5218,7 +5223,10 @@ wash:
|
|||||||
clean:
|
clean:
|
||||||
if (dangling_of_gpiod)
|
if (dangling_of_gpiod)
|
||||||
gpiod_put(config->ena_gpiod);
|
gpiod_put(config->ena_gpiod);
|
||||||
kfree(rdev);
|
if (reg_device_fail)
|
||||||
|
put_device(&rdev->dev);
|
||||||
|
else
|
||||||
|
kfree(rdev);
|
||||||
kfree(config);
|
kfree(config);
|
||||||
rinse:
|
rinse:
|
||||||
if (dangling_cfg_gpiod)
|
if (dangling_cfg_gpiod)
|
||||||
|
@@ -386,9 +386,16 @@ static int max77650_regulator_probe(struct platform_device *pdev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct of_device_id max77650_regulator_of_match[] = {
|
||||||
|
{ .compatible = "maxim,max77650-regulator" },
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(of, max77650_regulator_of_match);
|
||||||
|
|
||||||
static struct platform_driver max77650_regulator_driver = {
|
static struct platform_driver max77650_regulator_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "max77650-regulator",
|
.name = "max77650-regulator",
|
||||||
|
.of_match_table = max77650_regulator_of_match,
|
||||||
},
|
},
|
||||||
.probe = max77650_regulator_probe,
|
.probe = max77650_regulator_probe,
|
||||||
};
|
};
|
||||||
|
@@ -148,6 +148,7 @@ static struct platform_driver rn5t618_regulator_driver = {
|
|||||||
|
|
||||||
module_platform_driver(rn5t618_regulator_driver);
|
module_platform_driver(rn5t618_regulator_driver);
|
||||||
|
|
||||||
|
MODULE_ALIAS("platform:rn5t618-regulator");
|
||||||
MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>");
|
MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>");
|
||||||
MODULE_DESCRIPTION("RN5T618 regulator driver");
|
MODULE_DESCRIPTION("RN5T618 regulator driver");
|
||||||
MODULE_LICENSE("GPL v2");
|
MODULE_LICENSE("GPL v2");
|
||||||
|
@@ -588,7 +588,7 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev,
|
|||||||
if (of_property_read_u32(reg_np, "op_mode",
|
if (of_property_read_u32(reg_np, "op_mode",
|
||||||
&rmode->mode)) {
|
&rmode->mode)) {
|
||||||
dev_warn(iodev->dev,
|
dev_warn(iodev->dev,
|
||||||
"no op_mode property property at %pOF\n",
|
"no op_mode property at %pOF\n",
|
||||||
reg_np);
|
reg_np);
|
||||||
|
|
||||||
rmode->mode = S5M8767_OPMODE_NORMAL_MODE;
|
rmode->mode = S5M8767_OPMODE_NORMAL_MODE;
|
||||||
|
Reference in New Issue
Block a user