Skip to content

Commit e607879

Browse files
Yuuoniymiquelraynal
authored andcommitted
mtd: parsers: ofpart: Fix refcount leak in bcm4908_partitions_fw_offset
of_find_node_by_path() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: bb17230 ("mtd: parsers: ofpart: support BCM4908 fixed partitions") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220605070726.5979-1-linmq006@gmail.com
1 parent 9b78ef0 commit e607879

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/mtd/parsers/ofpart_bcm4908.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,15 @@ static long long bcm4908_partitions_fw_offset(void)
3535
err = kstrtoul(s + len + 1, 0, &offset);
3636
if (err) {
3737
pr_err("failed to parse %s\n", s + len + 1);
38+
of_node_put(root);
3839
return err;
3940
}
4041

42+
of_node_put(root);
4143
return offset << 10;
4244
}
4345

46+
of_node_put(root);
4447
return -ENOENT;
4548
}
4649

0 commit comments

Comments
 (0)