Skip to contentSkip to conversation

regulator/scmi: Add missing of_node_get()

PATCH In review Liang He 3 participants 4 messages Jun 22, 2022 – Jun 30, 2022

Subsystems (2)
lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 regulator/scmi: Add missing of_node_get()

In scmi_regulator_probe(), of_find_node_by_name() will decrease the refcount of its first argument and we need a of_node_get() to keep reference balance.

---
 drivers/regulator/scmi-regulator.c | 1 +
 1 file changed, 1 insertion(+)
drivers/regulator/scmi-regulator.c +1 -0
index 41ae7ac27ff6..b9918f4fd241 100644
@@ -343,6 +343,7 @@ static int scmi_regulator_probe(struct scmi_device *sdev)
 	 * plausible SCMI Voltage Domain number, all belonging to this SCMI
 	 * platform instance node (handle->dev->of_node).
 	 */
+	of_node_get(handle->dev->of_node);
 	np = of_find_node_by_name(handle->dev->of_node, "regulators");
 	for_each_child_of_node(np, child) {
 		ret = process_scmi_regulator_of_node(sdev, ph, child, rinfo);
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Liang He

In scmi_regulator_probe(), of_find_node_by_name() will decrease the refcount of its first argument and we need a of_node_get() to keep reference balance.

Hi Liang,

good catch.

I saw many other drivers that had this same issue fixed, given it is not so obvious, had also added some explaining comment like:

/* Balance of_node_put() done by of_find_node_by_name() */

so maybe it is a good idea to add something like that, but it depends at the end on how Mark prefers really. (given it is also in the commit log indeed...)

Instead, more certainly, I would add also a Fixes: tag to you patch.

Other than this:

Thanks,
Cristian

Quoted 19 lines
---
 drivers/regulator/scmi-regulator.c | 1 +
 1 file changed, 1 insertion(+)
drivers/regulator/scmi-regulator.c +1 -0
index 41ae7ac27ff6..b9918f4fd241 100644
@@ -343,6 +343,7 @@ static int scmi_regulator_probe(struct scmi_device *sdev)
 	 * plausible SCMI Voltage Domain number, all belonging to this SCMI
 	 * platform instance node (handle->dev->of_node).
 	 */
+	of_node_get(handle->dev->of_node);
 	np = of_find_node_by_name(handle->dev->of_node, "regulators");
 	for_each_child_of_node(np, child) {
 		ret = process_scmi_regulator_of_node(sdev, ph, child, rinfo);
Signature · 1 line
2.25.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author
#2 lore raw
Quoted 11 lines · Cristian Marussi
Quoted 5 lines · Liang He

In scmi_regulator_probe(), of_find_node_by_name() will decrease the refcount of its first argument and we need a of_node_get() to keep reference balance.

Hi Liang,

good catch.

Thanks.

Quoted 5 lines

I saw many other drivers that had this same issue fixed, given it is not so obvious, had also added some explaining comment like:

/* Balance of_node_put() done by of_find_node_by_name() */

Quoted 8 lines

so maybe it is a good idea to add something like that, but it depends at the end on how Mark prefers really. (given it is also in the commit log indeed...)

Instead, more certainly, I would add also a Fixes: tag to you patch.

Other than this:

Thanks, Cristian.

In fact, I know little aboult the rule of how to add 'Fixes: tag'.

Can you tell me about that and I will certainly add 'Fixes: tag' in future.

Quoted 9 lines

Thanks,
Cristian

Quoted 4 lines
---
 drivers/regulator/scmi-regulator.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 15 lines
Quoted 15 lines
drivers/regulator/scmi-regulator.c +1 -0
index 41ae7ac27ff6..b9918f4fd241 100644
@@ -343,6 +343,7 @@ static int scmi_regulator_probe(struct scmi_device *sdev)
 	 * plausible SCMI Voltage Domain number, all belonging to this SCMI
 	 * platform instance node (handle->dev->of_node).
 	 */
+	of_node_get(handle->dev->of_node);
 	np = of_find_node_by_name(handle->dev->of_node, "regulators");
 	for_each_child_of_node(np, child) {
 		ret = process_scmi_regulator_of_node(sdev, ph, child, rinfo);
Signature · 1 line
2.25.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer
#3 lore raw
In reply to Liang He
Quoted 5 lines · Liang He

In scmi_regulator_probe(), of_find_node_by_name() will decrease the refcount of its first argument and we need a of_node_get() to keep reference balance.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator/scmi: Add missing of_node_get()

      commit: a9e37a828ca069802b2f817e3cbf791b3806c97c

All 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

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel