Skip to content

Commit 015d188

Browse files
Jinjie Ruanlag-linaro
authored andcommitted
mfd: qcom-spmi-pmic: Use for_each_child_of_node_scoped()
Avoids the need for manual cleanup of_node_put() in early exits from the loop. Signed-off-by: Jinjie Ruan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 0db28e9 commit 015d188

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/mfd/qcom-spmi-pmic.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ static const struct of_device_id pmic_spmi_id_table[] = {
8484
static struct spmi_device *qcom_pmic_get_base_usid(struct spmi_device *sdev, struct qcom_spmi_dev *ctx)
8585
{
8686
struct device_node *spmi_bus;
87-
struct device_node *child;
8887
int function_parent_usid, ret;
8988
u32 pmic_addr;
9089

@@ -108,10 +107,9 @@ static struct spmi_device *qcom_pmic_get_base_usid(struct spmi_device *sdev, str
108107
*/
109108
spmi_bus = of_get_parent(sdev->dev.of_node);
110109
sdev = ERR_PTR(-ENODATA);
111-
for_each_child_of_node(spmi_bus, child) {
110+
for_each_child_of_node_scoped(spmi_bus, child) {
112111
ret = of_property_read_u32_index(child, "reg", 0, &pmic_addr);
113112
if (ret) {
114-
of_node_put(child);
115113
sdev = ERR_PTR(ret);
116114
break;
117115
}
@@ -125,7 +123,6 @@ static struct spmi_device *qcom_pmic_get_base_usid(struct spmi_device *sdev, str
125123
*/
126124
sdev = ERR_PTR(-EPROBE_DEFER);
127125
}
128-
of_node_put(child);
129126
break;
130127
}
131128
}

0 commit comments

Comments
 (0)