Skip to content

Commit

Permalink
mmc: atmel-mci: add missing of_node_put
Browse files Browse the repository at this point in the history
for_each_child_of_node performs an of_node_get on each
iteration, so a break out of the loop requires an
of_node_put.

This was done using the Coccinelle semantic patch
iterators/for_each_child.cocci

Signed-off-by: Julia Lawall <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ulf Hansson <[email protected]>
  • Loading branch information
JuliaLawall authored and storulf committed Sep 26, 2023
1 parent bbe6dc4 commit 134d3cf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/mmc/host/atmel-mci.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,10 @@ atmci_of_init(struct platform_device *pdev)
"cd", GPIOD_IN, "cd-gpios");
err = PTR_ERR_OR_ZERO(pdata->slot[slot_id].detect_pin);
if (err) {
if (err != -ENOENT)
if (err != -ENOENT) {
of_node_put(cnp);
return ERR_PTR(err);
}
pdata->slot[slot_id].detect_pin = NULL;
}

Expand All @@ -687,8 +689,10 @@ atmci_of_init(struct platform_device *pdev)
"wp", GPIOD_IN, "wp-gpios");
err = PTR_ERR_OR_ZERO(pdata->slot[slot_id].wp_pin);
if (err) {
if (err != -ENOENT)
if (err != -ENOENT) {
of_node_put(cnp);
return ERR_PTR(err);
}
pdata->slot[slot_id].wp_pin = NULL;
}
}
Expand Down

0 comments on commit 134d3cf

Please sign in to comment.