In rockchip_suspend_init(), of_find_matching_node_and_match() will return a node pointer with refcount incremented. We should use of_node_put() in fail path or when it is not used anymore.
Unified · Split
| @@ -311,7 +311,7 @@ void __init rockchip_suspend_init(void) · 310 unmodified lines | |||
| 311 | &match); | 311 | &match); |
| 312 | if (!match) { | 312 | if (!match) { |
| 313 | pr_err("Failed to find PMU node\n"); | 313 | pr_err("Failed to find PMU node\n"); |
| 314 | return; | 314 | goto out_put; |
| 315 | } | 315 | } |
| 316 | pm_data = (struct rockchip_pm_data *) match->data; | 316 | pm_data = (struct rockchip_pm_data *) match->data; |
| 317 | 317 | ||
| @@ -320,9 +320,12 @@ void __init rockchip_suspend_init(void) · 2 unmodified lines | |||
| 320 | 320 | ||
| 321 | if (ret) { | 321 | if (ret) { |
| 322 | pr_err("%s: matches init error %d\n", __func__, ret); | 322 | pr_err("%s: matches init error %d\n", __func__, ret); |
| 323 | return; | 323 | goto out_put; |
| 324 | } | 324 | } |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | suspend_set_ops(pm_data->ops); | 327 | suspend_set_ops(pm_data->ops); |
| 328 | |||
| 329 | out_put: | ||
| 330 | of_node_put(np); | ||
| 328 | } | 331 | } |