]> git.baikalelectronics.ru Git - kernel.git/commit
of/address: Fix of_node memory leak in of_dma_is_coherent
authorEvan Nimmo <evan.nimmo@alliedtelesis.co.nz>
Tue, 10 Nov 2020 02:28:25 +0000 (15:28 +1300)
committerRob Herring <robh@kernel.org>
Wed, 11 Nov 2020 23:10:16 +0000 (17:10 -0600)
commita2a818d18f44e16eb03c243cfa91fc9fa333acb3
treee20c708b57cd091758afcc458ce2fcca0b69e581
parent1a1a5d6cd1062ccc15f5dedff6e1f10224f45f11
of/address: Fix of_node memory leak in of_dma_is_coherent

Commit d19d2e8d214e ("of: Add OF_DMA_DEFAULT_COHERENT & select it on
powerpc") added a check to of_dma_is_coherent which returns early
if OF_DMA_DEFAULT_COHERENT is enabled. This results in the of_node_put()
being skipped causing a memory leak. Moved the of_node_get() below this
check so we now we only get the node if OF_DMA_DEFAULT_COHERENT is not
enabled.

Fixes: d19d2e8d214e ("of: Add OF_DMA_DEFAULT_COHERENT & select it on powerpc")
Signed-off-by: Evan Nimmo <evan.nimmo@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20201110022825.30895-1-evan.nimmo@alliedtelesis.co.nz
Signed-off-by: Rob Herring <robh@kernel.org>
drivers/of/address.c