mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
ion: msm: Correct OF node refcount handling in error paths
The for_each_[available]_child_of_node iterators implicitly increment the reference count on the current OF node at the start of the iteration, and decrements it at the end of the iteration. However, if the control flow is such that the loop can be broken out of prior to finishing an iteration, then the reference count must be decremented in the subsequent code path. Thus, fix the error path in the MSM ION code to decrement the reference on the current OF node when prematurely exiting an of_node loop. Change-Id: I5c2ec02a57eff416c04b1fe63c80d6e573a692d4 Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
parent
583ca0fad1
commit
03bb3d6ddd
2 changed files with 2 additions and 0 deletions
|
|
@ -405,6 +405,7 @@ ion_secure_carveout_heap_create(struct ion_platform_heap *heap_data)
|
|||
return &manager->heap.ion_heap;
|
||||
|
||||
err:
|
||||
of_node_put(np);
|
||||
ion_secure_carveout_heap_destroy(&manager->heap.ion_heap);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -430,6 +430,7 @@ static struct ion_platform_data *msm_ion_parse_dt(struct platform_device *pdev)
|
|||
return pdata;
|
||||
|
||||
free_heaps:
|
||||
of_node_put(node);
|
||||
release_reserved_memory_regions(pdata->heaps, idx);
|
||||
free_pdata(pdata);
|
||||
return ERR_PTR(ret);
|
||||
|
|
|
|||
Loading…
Reference in a new issue