of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. When kcalloc fails, it missing of_node_put() and results in refcount leak. Fix this by goto out_put_node label.
Unified · Split
| @@ -1932,7 +1932,7 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node) · 1931 unmodified lines | |||
| 1932 | 1932 | ||
| 1933 | gic_data.ppi_descs = kcalloc(gic_data.ppi_nr, sizeof(*gic_data.ppi_descs), GFP_KERNEL); | 1933 | gic_data.ppi_descs = kcalloc(gic_data.ppi_nr, sizeof(*gic_data.ppi_descs), GFP_KERNEL); |
| 1934 | if (!gic_data.ppi_descs) | 1934 | if (!gic_data.ppi_descs) |
| 1935 | return; | 1935 | goto out_put_node; |
| 1936 | 1936 | ||
| 1937 | nr_parts = of_get_child_count(parts_node); | 1937 | nr_parts = of_get_child_count(parts_node); |
| 1938 | 1938 | ||