Skip to content

Commit 3a0278c

Browse files
MrVanlinusw
authored andcommitted
pinctrl: mediatek: Use scope based of_node_put() cleanups
Use scope based of_node_put() cleanup to simplify code. Signed-off-by: Peng Fan <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent c957ae7 commit 3a0278c

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

drivers/pinctrl/mediatek/pinctrl-mtk-common.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -621,20 +621,18 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
621621
struct device_node *np_config,
622622
struct pinctrl_map **map, unsigned *num_maps)
623623
{
624-
struct device_node *np;
625624
unsigned reserved_maps;
626625
int ret;
627626

628627
*map = NULL;
629628
*num_maps = 0;
630629
reserved_maps = 0;
631630

632-
for_each_child_of_node(np_config, np) {
631+
for_each_child_of_node_scoped(np_config, np) {
633632
ret = mtk_pctrl_dt_subnode_to_map(pctldev, np, map,
634633
&reserved_maps, num_maps);
635634
if (ret < 0) {
636635
pinctrl_utils_free_map(pctldev, *map, *num_maps);
637-
of_node_put(np);
638636
return ret;
639637
}
640638
}

drivers/pinctrl/mediatek/pinctrl-paris.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,21 +536,19 @@ static int mtk_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
536536
struct pinctrl_map **map,
537537
unsigned *num_maps)
538538
{
539-
struct device_node *np;
540539
unsigned reserved_maps;
541540
int ret;
542541

543542
*map = NULL;
544543
*num_maps = 0;
545544
reserved_maps = 0;
546545

547-
for_each_child_of_node(np_config, np) {
546+
for_each_child_of_node_scoped(np_config, np) {
548547
ret = mtk_pctrl_dt_subnode_to_map(pctldev, np, map,
549548
&reserved_maps,
550549
num_maps);
551550
if (ret < 0) {
552551
pinctrl_utils_free_map(pctldev, *map, *num_maps);
553-
of_node_put(np);
554552
return ret;
555553
}
556554
}

0 commit comments

Comments
 (0)