regulator: qcom_spmi: Drop unnecessary of_find_property() call
PATCH 1/2 regulator: qcom_spmi: Drop unnecessary of_find_property() call
There's no need to check for presence of "qcom,saw-reg" before parsing it. If the property doesn't exist, parsing it will return NULL.
--- drivers/regulator/qcom_spmi-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/qcom_spmi-regulator.c +2 -2
@@ -2528,8 +2528,8 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev)if (!reg)return -ENODEV ; -if (of_find_property (node,"qcom,saw-reg" , &lenp)) { - syscon =of_parse_phandle (node,"qcom,saw-reg" ,0 ); + syscon =of_parse_phandle (node,"qcom,saw-reg" ,0 ); +if (syscon) { saw_regmap =syscon_node_to_regmap (syscon);of_node_put (syscon);if (IS_ERR (saw_regmap))
Signature · 1 line
2.45.2
PATCH 2/2 regulator: qcom_spmi: Use of_property_read_bool()
Use of_property_read_bool() to read boolean properties rather than of_find_property(). This is part of a larger effort to remove callers of of_find_property() and similar functions. of_find_property() leaks the DT property pointer which is a problem for dynamically allocated nodes which may be freed.
--- drivers/regulator/qcom_spmi-regulator.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/regulator/qcom_spmi-regulator.c +2 -4
@@ -2577,15 +2577,13 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev)if (saw_regmap) { reg_node =of_get_child_by_name (node, reg->name); - reg_prop =of_find_property (reg_node,"qcom,saw-leader" , - &lenp); -of_node_put (reg_node); -if (reg_prop) { +if (of_property_read_bool (reg_node,"qcom,saw-leader" )) { spmi_saw_ops = *(vreg->desc.ops); spmi_saw_ops.set_voltage_sel = spmi_regulator_saw_set_voltage; vreg->desc.ops = &spmi_saw_ops; } +of_node_put (reg_node); }if (vreg->set_points && vreg->set_points->count ==1 ) {
Signature · 1 line
2.45.2
Quoted 8 lines · Rob Herring (Arm)
There's no need to check for presence of "qcom,saw-reg" before parsing it. If the property doesn't exist, parsing it will return NULL.
Signed-off-by Rob Herring (Arm) <[email protected]>--- drivers/regulator/qcom_spmi-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH 2/2] regulator: qcom_spmi: Use of_property_read_bool()
In reply to Rob Herring (Arm)Quoted 11 lines · Rob Herring (Arm)
Use
of_property_read_bool()to read boolean properties rather thanof_find_property(). This is part of a larger effort to remove callers ofof_find_property()and similar functions.of_find_property()leaks the DT property pointer which is a problem for dynamically allocated nodes which may be freed.Signed-off-by Rob Herring (Arm) <[email protected]>--- drivers/regulator/qcom_spmi-regulator.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Mark Brown
maintainerQuoted 4 lines · Rob Herring (Arm)
There's no need to check for presence of "qcom,saw-reg" before parsing it. If the property doesn't exist, parsing it will return NULL.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/2] regulator: qcom_spmi: Drop unnecessary of_find_property() call
commit: 7540bd3398675e54cbd7324c47be8cd3c7a6d9c5
[2/2] regulator: qcom_spmi: Use of_property_read_bool()
commit: dd72a3b8a6007b44ed3b85e1d606afc434879e70All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark